mpruett / audiofile

Audio File Library
https://audiofile.68k.org/
GNU Lesser General Public License v2.1
154 stars 41 forks source link

A heap-buffer-overflow has occurred when running sfconvert #50

Open swtkiwi opened 6 years ago

swtkiwi commented 6 years ago

A heap-buffer-overflow has occurred when running sfconvert.

=================================================================
==16798==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f000fca7800 at pc 0x7f000e8f996c bp 0x7ffc39a7a360 sp 0x7ffc39a7a350
WRITE of size 4 at 0x7f000fca7800 thread T0
    #0 0x7f000e8f996b in void Expand3To4Module::run<int>(unsigned char const*, int*, int) /home/sandy/swt_fuzz/audiofile/libaudiofile/modules/SimpleModule.h:269
    #1 0x7f000e8f4692 in Expand3To4Module::run(Chunk&, Chunk&) /home/sandy/swt_fuzz/audiofile/libaudiofile/modules/SimpleModule.h:244
    #2 0x7f000e91810e in SimpleModule::runPull() /home/sandy/swt_fuzz/audiofile/libaudiofile/modules/SimpleModule.cpp:29
    #3 0x7f000e8ba550 in afReadFrames /home/sandy/swt_fuzz/audiofile/libaudiofile/data.cpp:222
    #4 0x403c7e in copyaudiodata /home/sandy/swt_fuzz/audiofile/sfcommands/sfconvert.c:340
    #5 0x403793 in main /home/sandy/swt_fuzz/audiofile/sfcommands/sfconvert.c:248
    #6 0x7f000e47a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #7 0x4017a8 in _start (/home/sandy/swt_fuzz/audiofile/sfcommands/.libs/sfconvert+0x4017a8)

0x7f000fca7800 is located 0 bytes to the right of 524288-byte region [0x7f000fc27800,0x7f000fca7800)
allocated by thread T0 here:
    #0 0x7f000ec09602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x403c1b in copyaudiodata /home/sandy/swt_fuzz/audiofile/sfcommands/sfconvert.c:327
    #2 0x403793 in main /home/sandy/swt_fuzz/audiofile/sfcommands/sfconvert.c:248
    #3 0x7f000e47a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/sandy/swt_fuzz/audiofile/libaudiofile/modules/SimpleModule.h:269 void Expand3To4Module::run<int>(unsigned char const*, int*, int)
Shadow bytes around the buggy address:
  0x0fe081f8ceb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe081f8cec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe081f8ced0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe081f8cee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe081f8cef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fe081f8cf00:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe081f8cf10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe081f8cf20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe081f8cf30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe081f8cf40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe081f8cf50: 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
==16798==ABORTING

And the input file has been put at: https://github.com/fCorleone/fuzz_programs/blob/master/audiofile/test1

abergmann commented 6 years ago

CVE-2018-17095 was assigned to this issue.