mirror of
				https://github.com/GrapheneOS/hardened_malloc.git
				synced 2025-11-03 20:24:04 -05:00 
			
		
		
		
	add test for delete size mismatch
This commit is contained in:
		
							parent
							
								
									7606bf4c1f
								
							
						
					
					
						commit
						e47c783524
					
				
					 2 changed files with 15 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -22,7 +22,8 @@ EXECUTABLES := \
 | 
			
		|||
    uninitialized_malloc_usable_size \
 | 
			
		||||
    eight_byte_overflow_small \
 | 
			
		||||
    eight_byte_overflow_large \
 | 
			
		||||
    string_overflow
 | 
			
		||||
    string_overflow \
 | 
			
		||||
    delete_type_size_mismatch
 | 
			
		||||
 | 
			
		||||
all: $(EXECUTABLES)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										13
									
								
								test/simple-memory-corruption/delete_type_size_mismatch.cc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								test/simple-memory-corruption/delete_type_size_mismatch.cc
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
struct foo {
 | 
			
		||||
    uint64_t a, b, c, d;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
__attribute__((optimize(0)))
 | 
			
		||||
int main(void) {
 | 
			
		||||
    void *p = new char;
 | 
			
		||||
    struct foo *c = (struct foo *)p;
 | 
			
		||||
    delete c;
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue