I used Clang 6.0 and AddressSanitizer to build jpeg-encoder, this file can cause heap-buffer-overflow in function readFromBMP when executing this command:
./a.out heap_buffer_overflow_readFromBMP
This is the ASAN information:
=================================================================
==328==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x616000000368 at pc 0x00000049ea5c bp 0x7fff6b99bdb0 sp 0x7fff6b99b560
WRITE of size 24 at 0x616000000368 thread T0
#0 0x49ea5b in fread /home/fouzhe/llvm/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:978#1 0x51c515 in JpegEncoder::readFromBMP(char const*) /home/fouzhe/my_fuzz/jpeg_encoder/jpeg_encoder.cpp:202:17#2 0x51a88b in main /home/fouzhe/my_fuzz/jpeg_encoder/test.cpp:16:14#3 0x7f7a716a882f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)#4 0x41a638 in _start (/home/fouzhe/my_fuzz/jpeg_encoder/a.out+0x41a638)
0x616000000368 is located 192 bytes to the right of 552-byte region [0x616000000080,0x6160000002a8)
allocated by thread T0 here:
#0 0x4de868 in __interceptor_malloc /home/fouzhe/llvm/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:88#1 0x7f7a716f5cdc (/lib/x86_64-linux-gnu/libc.so.6+0x6dcdc)
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fouzhe/llvm/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:978 in fread
Shadow bytes around the buggy address:
0x0c2c7fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c2c7fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c2c7fff8030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c2c7fff8040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c2c7fff8050: 00 00 00 00 00 fa fa fa fa fa fa fa fa fa fa fa
=>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
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
==328==ABORTING
The text was updated successfully, but these errors were encountered:
I used Clang 6.0 and AddressSanitizer to build jpeg-encoder, this file can cause heap-buffer-overflow in function readFromBMP when executing this command:
This is the ASAN information:
================================================================= ==328==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x616000000368 at pc 0x00000049ea5c bp 0x7fff6b99bdb0 sp 0x7fff6b99b560 WRITE of size 24 at 0x616000000368 thread T0 #0 0x49ea5b in fread /home/fouzhe/llvm/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:978 #1 0x51c515 in JpegEncoder::readFromBMP(char const*) /home/fouzhe/my_fuzz/jpeg_encoder/jpeg_encoder.cpp:202:17 #2 0x51a88b in main /home/fouzhe/my_fuzz/jpeg_encoder/test.cpp:16:14 #3 0x7f7a716a882f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #4 0x41a638 in _start (/home/fouzhe/my_fuzz/jpeg_encoder/a.out+0x41a638) 0x616000000368 is located 192 bytes to the right of 552-byte region [0x616000000080,0x6160000002a8) allocated by thread T0 here: #0 0x4de868 in __interceptor_malloc /home/fouzhe/llvm/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:88 #1 0x7f7a716f5cdc (/lib/x86_64-linux-gnu/libc.so.6+0x6dcdc) SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fouzhe/llvm/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:978 in fread Shadow bytes around the buggy address: 0x0c2c7fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2c7fff8050: 00 00 00 00 00 fa fa fa fa fa fa fa fa fa fa fa =>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 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 ==328==ABORTINGThe text was updated successfully, but these errors were encountered: