| Summary: | Heap-Buffer Overflow in SDL_LoadWAV_RW (IMA_ADPCM_decode) | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Radue <epitectus.agamemon> |
| Component: | audio | Assignee: | Simon Hug <chli.hug> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | critical | ||
| Priority: | P2 | CC: | ppisar |
| Version: | HG 1.2 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
PoC
Fix |
||
Assigned CVE-2019-7574 by MITRE. Created attachment 3610 [details]
Fix
Fixed, thanks! https://hg.libsdl.org/SDL/rev/a6e3d2f5183e This code has been rewritten in SDL 2.0, can you verify that this issue has been fixed there? http://www.libsdl.org/tmp/SDL-2.0.zip The WAVE file (attachment 3602 [details]) specifies a 1 byte IMA ADPCM block size with 57120 sample frames per block. Pretty good compression, if it would work like that. Also seems to have the MS ADPCM coefficients attached in the fmt chunk.
With the current tip, SDL_LoadWAV_RW rejects this file with "Invalid IMA ADPCM block size (nBlockAlign)" as it detects that the block size is just too small.
Great, thanks! |
Created attachment 3602 [details] PoC A heap buffer overflow vulnerability was discovered in SDL-1.2.15 library. Asan output: ================================================================= ==23116==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61200000bfcd at pc 0x7fb733c1cdea bp 0x7ffc5475fa70 sp 0x7ffc5475fa68 READ of size 1 at 0x61200000bfcd thread T0 #0 0x7fb733c1cde9 in IMA_ADPCM_decode /home/radu/apps/sdl_player_lib/SDL-1.2.15/build/../src/audio/SDL_wave.c:358:24 #1 0x7fb733c1cde9 in SDL_LoadWAV_RW /home/radu/apps/sdl_player_lib/SDL-1.2.15/build/../src/audio/SDL_wave.c:542 #2 0x4db938 in main /home/radu/apps/sdl_player_lib/SDL-1.2.15/test/loopwave.c:76:7 #3 0x7fb73298e82f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291 #4 0x4352f8 in _start (/home/radu/apps/sdl_player_lib/SDL-1.2.15/test/loopwave+0x4352f8) 0x61200000bfcd is located 0 bytes to the right of 269-byte region [0x61200000bec0,0x61200000bfcd) allocated by thread T0 here: #0 0x4bc2c2 in malloc (/home/radu/apps/sdl_player_lib/SDL-1.2.15/test/loopwave+0x4bc2c2) #1 0x7fb733c1cea1 in ReadChunk /home/radu/apps/sdl_player_lib/SDL-1.2.15/build/../src/audio/SDL_wave.c:584:25 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/radu/apps/sdl_player_lib/SDL-1.2.15/build/../src/audio/SDL_wave.c:358 IMA_ADPCM_decode Shadow bytes around the buggy address: 0x0c247fff97a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff97b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff97c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff97d0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c247fff97e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c247fff97f0: 00 00 00 00 00 00 00 00 00[05]fa fa fa fa fa fa 0x0c247fff9800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff9810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff9820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff9830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c247fff9840: 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 Left alloca redzone: ca Right alloca redzone: cb ==23116==ABORTING PoC: See attachment Reproducing steps: 1. Download SDL-1.2.15 library 2. ./configure with Asan enabled 3. ./make 4. sudo make install 5. cd examples 6. ./configure with Asan enabled 7. make 8. ./loopwave PoC