I used clang 6.0 and AddressSanitizer to build LuPng, this file can cause heap buffer overflow in function insertByte(598:37) in lupng.c when executing this command:
./lupng heap-buffer-overflow_insertByte_598 1.png
This is the ASAN information:
=================================================================
==21120==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6160000005de at pc 0x00000052eac5 bp 0x7ffe0a8090e0 sp 0x7ffe0a8090d8
WRITE of size 1 at 0x6160000005de thread T0
#0 0x52eac4 in insertByte /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:598:37#1 0x519d0c in luPngReadUC /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:718:28#2 0x520b90 in luPngReadFile /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:859:15#3 0x515cff in main /home/fouzhe/my_fuzz/LuPng/miniz/example.c:23:11#4 0x7f54160b282f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)#5 0x41a028 in _start (/home/fouzhe/my_fuzz/LuPng/miniz/lupng+0x41a028)
0x6160000005de is located 30 bytes to the right of 576-byte region [0x616000000380,0x6160000005c0)
allocated by thread T0 here:
#0 0x4de258 in __interceptor_malloc /home/fouzhe/llvm/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:88#1 0x52c455 in luImageCreate /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:1213:32#2 0x51b7a2 in parseIhdr /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:477:17#3 0x51b7a2 in handleChunk /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:772#4 0x51b7a2 in luPngReadUC /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:814#5 0x520b90 in luPngReadFile /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:859:15#6 0x515cff in main /home/fouzhe/my_fuzz/LuPng/miniz/example.c:23:11
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:598:37 in insertByte
Shadow bytes around the buggy address:
0x0c2c7fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2c7fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c2c7fff8080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c2c7fff8090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c2c7fff80a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c2c7fff80b0: 00 00 00 00 00 00 00 00 fa fa fa[fa]fa fa fa fa
0x0c2c7fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2c7fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2c7fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2c7fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2c7fff8100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==21120==ABORTING
The text was updated successfully, but these errors were encountered:
I used clang 6.0 and AddressSanitizer to build LuPng, this file can cause heap buffer overflow in function insertByte(598:37) in lupng.c when executing this command:
This is the ASAN information:
================================================================= ==21120==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6160000005de at pc 0x00000052eac5 bp 0x7ffe0a8090e0 sp 0x7ffe0a8090d8 WRITE of size 1 at 0x6160000005de thread T0 #0 0x52eac4 in insertByte /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:598:37 #1 0x519d0c in luPngReadUC /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:718:28 #2 0x520b90 in luPngReadFile /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:859:15 #3 0x515cff in main /home/fouzhe/my_fuzz/LuPng/miniz/example.c:23:11 #4 0x7f54160b282f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #5 0x41a028 in _start (/home/fouzhe/my_fuzz/LuPng/miniz/lupng+0x41a028) 0x6160000005de is located 30 bytes to the right of 576-byte region [0x616000000380,0x6160000005c0) allocated by thread T0 here: #0 0x4de258 in __interceptor_malloc /home/fouzhe/llvm/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:88 #1 0x52c455 in luImageCreate /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:1213:32 #2 0x51b7a2 in parseIhdr /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:477:17 #3 0x51b7a2 in handleChunk /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:772 #4 0x51b7a2 in luPngReadUC /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:814 #5 0x520b90 in luPngReadFile /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:859:15 #6 0x515cff in main /home/fouzhe/my_fuzz/LuPng/miniz/example.c:23:11 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fouzhe/my_fuzz/LuPng/miniz/lupng.c:598:37 in insertByte Shadow bytes around the buggy address: 0x0c2c7fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff80a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c2c7fff80b0: 00 00 00 00 00 00 00 00 fa fa fa[fa]fa fa fa fa 0x0c2c7fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2c7fff8100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==21120==ABORTINGThe text was updated successfully, but these errors were encountered: