Fix undefined behavior when hash function given null pointer
[test_subscriber-12] /opt/ros/master/src/eclipse-cyclonedds/cyclonedds/src/ddsrt/src/mh3.c:28:53: runtime error: applying zero offset to null pointer [test_subscriber-12] SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/ros/master/src/eclipse-cyclonedds/cyclonedds/src/ddsrt/src/mh3.c:28:53 in Signed-off-by: Dan Rose <dan@digilabs.io>
This commit is contained in:
		
							parent
							
								
									e8b0931798
								
							
						
					
					
						commit
						ca4b5a368f
					
				
					 2 changed files with 30 additions and 27 deletions
				
			
		| 
						 | 
				
			
			@ -56,7 +56,7 @@ static uint32_t sertopic_default_hash (const struct ddsi_sertopic *tpcmn)
 | 
			
		|||
{
 | 
			
		||||
  const struct ddsi_sertopic_default *tp = (struct ddsi_sertopic_default *) tpcmn;
 | 
			
		||||
  uint32_t h = 0;
 | 
			
		||||
  h = ddsrt_mh3 (&tp->native_encoding_identifier, sizeof (tp->native_encoding_identifier), 0);
 | 
			
		||||
  h = ddsrt_mh3 (&tp->native_encoding_identifier, sizeof (tp->native_encoding_identifier), h);
 | 
			
		||||
  h = ddsrt_mh3 (&tp->type.m_size, sizeof (tp->type.m_size), h);
 | 
			
		||||
  h = ddsrt_mh3 (&tp->type.m_align, sizeof (tp->type.m_align), h);
 | 
			
		||||
  h = ddsrt_mh3 (&tp->type.m_flagset, sizeof (tp->type.m_flagset), h);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue