mirror of
				https://github.com/eledio-devices/thirdparty-miniz.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	ossfuzz: add fuzzers
This commit is contained in:
		
							
								
								
									
										25
									
								
								tests/checksum_fuzzer.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								tests/checksum_fuzzer.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| /* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib, | ||||
|  * see ossfuzz.sh for full license text. | ||||
| */ | ||||
|  | ||||
| #include <stddef.h> | ||||
| #include <stdint.h> | ||||
| #include <inttypes.h> | ||||
|  | ||||
| #include "miniz.h" | ||||
|  | ||||
| static const size_t kMaxSize = 1024 * 1024; | ||||
|  | ||||
| int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) | ||||
| { | ||||
|     /* Discard inputs larger than 1Mb. */ | ||||
|     if (dataLen < 1 || dataLen > kMaxSize) return 0; | ||||
|  | ||||
|     uint32_t crc = crc32(0L, NULL, 0); | ||||
|     uint32_t adler = adler32(0L, NULL, 0); | ||||
|  | ||||
|     crc = crc32(crc, data, (uint32_t) dataLen); | ||||
|     adler = adler32(adler, data, (uint32_t) dataLen); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user