Opened 3 hours ago

#11416 new defect

libavutil/iamf.c memory leaks

Reported by: 0x20z Owned by:
Priority: important Component: avutil
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Dear developers,

I have discovered a memory leaks vulnerability. The POC file is attached to the session, and the version of ffmpeg is the main branch. Please confirm.

With https://trac.ffmpeg.org/ticket/11415 Compared to others,
Although both leaks used FFmpeg's memory allocation system (both starting from posix_emalign), they:

The leaked memory size is different (48 bytes vs 112 bytes)
Occurring in different subsystems (IAMF parsing vs encapsulation)
Occurring at different stages of media processing (input vs output)
There are different call stacks that involve different functionalities
So these are two independent issues that need to be fixed separately.

How to reproduce:

git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
./configure --cc=clang --cxx=clang++ --toolchain=clang-asan --extra-cflags="-I$HOME/ffmpeg_build/include -O0 -fno-omit-frame-pointer -g"   --extra-cxxflags="-O0 -fno-omit-frame-pointer -g" --extra-ldflags="-L$HOME/ffmpeg_build/include -fsanitize=address -fsanitize=undefined -lubsan" --disable-optimizations --disable-stripping --enable-cross-compile
make -j30
./ffmpeg -y -i poc -c:v mpeg4 -c:a copy -f mp4 /dev/null

LeakSanitizer :

==572378==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x5a527bba9a47 in posix_memalign (/home/swift/workstation/FFmpeg/ffmpeg+0x804a47) (BuildId: cb5cd0d261a2955cf44e6c06c3b59ca23341b342)
    #1 0x5a528078075f in av_malloc /home/swift/workstation/FFmpeg/libavutil/mem.c:107:9
    #2 0x5a52807814a4 in av_mallocz /home/swift/workstation/FFmpeg/libavutil/mem.c:258:17
    #3 0x5a528076226e in av_iamf_param_definition_alloc /home/swift/workstation/FFmpeg/libavutil/iamf.c:201:11
    #4 0x5a527d3fb9a3 in param_parse /home/swift/workstation/FFmpeg/libavformat/iamf_parse.c:531:13
    #5 0x5a527d3f8f9b in mix_presentation_obu /home/swift/workstation/FFmpeg/libavformat/iamf_parse.c:942:15
    #6 0x5a527d3f4865 in ff_iamfdec_read_descriptors /home/swift/workstation/FFmpeg/libavformat/iamf_parse.c:1114:19
    #7 0x5a527ce28246 in iamf_read_header /home/swift/workstation/FFmpeg/libavformat/iamfdec.c:78:11
    #8 0x5a527cce768a in avformat_open_input /home/swift/workstation/FFmpeg/libavformat/demux.c:308:20
    #9 0x5a527bbffb37 in ifile_open /home/swift/workstation/FFmpeg/fftools/ffmpeg_demux.c:1727:11
    #10 0x5a527bc80602 in open_files /home/swift/workstation/FFmpeg/fftools/ffmpeg_opt.c:1363:15
    #11 0x5a527bc7feb8 in ffmpeg_parse_options /home/swift/workstation/FFmpeg/fftools/ffmpeg_opt.c:1412:11
    #12 0x5a527bcc91fd in main /home/swift/workstation/FFmpeg/fftools/ffmpeg.c:974:11
    #13 0x756408429d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16


Found by:

Found by 0x20z

Thank you for your time and attention

Attachments (1)

poc44 (476 bytes ) - added by 0x20z 3 hours ago.

Download all attachments as: .zip

Change History (1)

by 0x20z, 3 hours ago

Attachment: poc44 added
Note: See TracTickets for help on using tickets.