mirror of
				https://github.com/GrapheneOS/hardened_malloc.git
				synced 2025-10-31 08:16:31 +01:00 
			
		
		
		
	add uninitialized allocator tests
This commit is contained in:
		
							parent
							
								
									2d168b0516
								
							
						
					
					
						commit
						fe85116891
					
				
					 4 changed files with 27 additions and 0 deletions
				
			
		|  | @ -12,3 +12,6 @@ all: \ | |||
|     invalid_free_protected \
 | ||||
|     invalid_free_unprotected \
 | ||||
|     invalid_free_small_region \
 | ||||
|     uninitialized_free \
 | ||||
|     uninitialized_realloc \
 | ||||
|     uninitialized_malloc_usable_size \
 | ||||
|  |  | |||
							
								
								
									
										7
									
								
								test/simple-memory-corruption/uninitialized_free.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								test/simple-memory-corruption/uninitialized_free.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| #include <stdlib.h> | ||||
| 
 | ||||
| __attribute__((optimize(0))) | ||||
| int main(void) { | ||||
|     free((void *)1); | ||||
|     return 0; | ||||
| } | ||||
|  | @ -0,0 +1,7 @@ | |||
| #include <malloc.h> | ||||
| 
 | ||||
| __attribute__((optimize(0))) | ||||
| int main(void) { | ||||
|     malloc_usable_size((void *)1); | ||||
|     return 0; | ||||
| } | ||||
							
								
								
									
										10
									
								
								test/simple-memory-corruption/uninitialized_realloc.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								test/simple-memory-corruption/uninitialized_realloc.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <stdlib.h> | ||||
| 
 | ||||
| __attribute__((optimize(0))) | ||||
| int main(void) { | ||||
|     void *p = realloc((void *)1, 16); | ||||
|     if (!p) { | ||||
|         return 1; | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
		Loading…
	
	Add table
		
		Reference in a new issue