I used g++ 5.4 and AddressSanitizer to build doc2txt, this file can cause heap buffer overflow in function Storage::init in Storage.cpp when executing this command(pic is just a folder which is used to store the picture in doc file):
=================================================================
==5702==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62100001ca1c at pc 0x7f723d545bec bp 0x7fff6a6378f0 sp 0x7fff6a637098
WRITE of size 8760 at 0x62100001ca1c thread T0
#0 0x7f723d545beb in __asan_memset (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x8cbeb)#1 0x404eb2 in memset /usr/include/x86_64-linux-gnu/bits/string3.h:90#2 0x404eb2 in Storage::init(_IO_FILE*) src/Storage.cpp:160#3 0x406a3e in parse_doc(char const*, char const*, char const*) src/parse_doc.cpp:20#4 0x4018b2 in main src/main.cpp:10#5 0x7f723cb7782f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)#6 0x401c78 in _start (/home/fouzhe/my_fuzz/doc2txt/doc2txt+0x401c78)
0x62100001ca1c is located 0 bytes to the right of 4380-byte region [0x62100001b900,0x62100001ca1c)
allocated by thread T0 here:
#0 0x7f723d551602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)#1 0x404e46 in Storage::init(_IO_FILE*) src/Storage.cpp:156#2 0x7fff6a637b9f (<unknown module>)
SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 __asan_memset
Shadow bytes around the buggy address:
0x0c427fffb8f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fffb900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fffb910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fffb920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fffb930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c427fffb940: 00 00 00[04]fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fffb950: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fffb960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fffb970: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fffb980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fffb990: 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
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
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
==5702==ABORTING
The text was updated successfully, but these errors were encountered:
I used g++ 5.4 and AddressSanitizer to build doc2txt, this file can cause heap buffer overflow in function Storage::init in Storage.cpp when executing this command(pic is just a folder which is used to store the picture in doc file):
This is the ASAN information:
================================================================= ==5702==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62100001ca1c at pc 0x7f723d545bec bp 0x7fff6a6378f0 sp 0x7fff6a637098 WRITE of size 8760 at 0x62100001ca1c thread T0 #0 0x7f723d545beb in __asan_memset (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x8cbeb) #1 0x404eb2 in memset /usr/include/x86_64-linux-gnu/bits/string3.h:90 #2 0x404eb2 in Storage::init(_IO_FILE*) src/Storage.cpp:160 #3 0x406a3e in parse_doc(char const*, char const*, char const*) src/parse_doc.cpp:20 #4 0x4018b2 in main src/main.cpp:10 #5 0x7f723cb7782f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #6 0x401c78 in _start (/home/fouzhe/my_fuzz/doc2txt/doc2txt+0x401c78) 0x62100001ca1c is located 0 bytes to the right of 4380-byte region [0x62100001b900,0x62100001ca1c) allocated by thread T0 here: #0 0x7f723d551602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x404e46 in Storage::init(_IO_FILE*) src/Storage.cpp:156 #2 0x7fff6a637b9f (<unknown module>) SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 __asan_memset Shadow bytes around the buggy address: 0x0c427fffb8f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fffb900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fffb910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fffb920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fffb930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c427fffb940: 00 00 00[04]fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fffb950: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fffb960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fffb970: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fffb980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fffb990: 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 Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 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 ==5702==ABORTINGThe text was updated successfully, but these errors were encountered: