Closed De4dCr0w closed 4 years ago
I think this is the same underlying problem as https://github.com/dr-soft/miniaudio/issues/166. Should be fixed in the dev branch. Thanks for the report!
It has fixed the stack-buffer-overflow, but i find the memory leak. I guess it maybe relates to simple_playback.c, there maybe add 'xxx_uninit' function like what? I don't know. FYI
$ valgrind --leak-check=full ./simple-playback ./poc-stack1
==4066654== Memcheck, a memory error detector
==4066654== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==4066654== Using Valgrind-3.16.0 and LibVEX; rerun with -h for copyright info
==4066654== Command: ./test-poc /mnt/hgfs/fuzz-everything/crashes/miniaudio/poc-stack1
==4066654==
==4066654==
==4066654== HEAP SUMMARY:
==4066654== in use at exit: 912 bytes in 2 blocks
==4066654== total heap usage: 3 allocs, 1 frees, 1,936 bytes allocated
==4066654==
==4066654== 440 bytes in 1 blocks are definitely lost in loss record 1 of 2
==4066654== at 0x483B7FB: malloc (vg_replace_malloc.c:307)
==4066654== by 0x14F114: ma__malloc_default (miniaudio.h:8547)
==4066654== by 0x14F1B0: ma__malloc_from_callbacks (miniaudio.h:8570)
==4066654== by 0x17E8B7: ma_decoder_init_wav__internal (miniaudio.h:42536)
==4066654== by 0x180261: ma_decoder_init__internal (miniaudio.h:43515)
==4066654== by 0x181641: ma_decoder_init_vfs (miniaudio.h:44054)
==4066654== by 0x1823B3: ma_decoder_init_file (miniaudio.h:44404)
==4066654== by 0x187DF2: main (simple_playback.c:37)
==4066654==
==4066654== LEAK SUMMARY:
==4066654== definitely lost: 440 bytes in 1 blocks
==4066654== indirectly lost: 0 bytes in 0 blocks
==4066654== possibly lost: 0 bytes in 0 blocks
==4066654== still reachable: 472 bytes in 1 blocks
==4066654== suppressed: 0 bytes in 0 blocks
==4066654== Reachable blocks (those to which a pointer was found) are not shown.
==4066654== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==4066654==
==4066654== For lists of detected and suppressed errors, rerun with: -s
==4066654== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Thanks! I've pushed a potential fix for the memory leak to the dev branch.
Another stack-buffer-overflow vulnerability in ma_channel_map_blank (miniaudio.h:38973)
Asan report:
And I used gdb to debug the poc, and find the value of 'channels' was 172, but the size of channelMap array was 32. So it exists a stack-buffer-read-overflow vulnerability truely.
poc-stack2.zip