Closed Cvjark closed 2 years ago
It's trying to allocate a very large buffer because the header indicates 1052688x269488144 pixels. You can use a compile option to prevent large allocations for fuzzing: add -DLODEPNG_MAX_ALLOC=100000000
to the compiler flags.
It can be argued whether trying such large allocation is a vulnerability or not, but by default lodepng does not set a limit, say e.g. an image that requires 100GB of memory: there can be legit use cases, and legit machines that can decode it, while it'd still go out of memory on other machines.
Which is why the DLODEPNG_MAX_ALLOC compiler option is added, does -DLODEPNG_MAX_ALLOC=100000000
solve the issue for you?
yes, it is. I forgot to add a limit for the fuzzer, thank you for your reply.
==93357==ERROR: AddressSanitizer: requested allocation size 0x2040616141210 (0x2040616142210 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0)
0 0x55d0e8 in realloc /home/bupt/桌面/tools/llvm-12.0.1/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:164
==93357==HINT: if you don't care about these errors you may set allocator_may_return_null=1 SUMMARY: AddressSanitizer: allocation-size-too-big /home/bupt/桌面/tools/llvm-12.0.1/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:164 in realloc ==93357==ABORTING MS: 1 InsertRepeatedBytes-; base unit: 8998bc5c20a834a66a360df3b0af13c6caa67f1e 0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0,0x0,0x0,0x0,0xff,0xff,0x21,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0x2f,0xff, \x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\x10\x10\x10\x10\x10\x10\x10\x10\x00\x00\x00\x00\xff\xff!\xff\xff\xff\xff\xff\xff\xdf\xff/\xff artifact_prefix='./'; Test unit written to ./crash-a035941c68e4300728c51d72fa43243ea3046182 Base64: iVBORw0KGgoAAAANSUhEUgAQEBAQEBAQEAAAAAD//yH////////f/y// crash-a035941c68e4300728c51d72fa43243ea3046182.zip