[FFmpeg-trac] #8230(avformat:new): avformat_open_input leaks memory
FFmpeg
trac at avcodec.org
Tue Oct 8 14:23:21 EEST 2019
#8230: avformat_open_input leaks memory
----------------------------------+----------------------------------
Reporter: justinas | Type: defect
Status: new | Priority: normal
Component: avformat | Version: 4.1.4
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+----------------------------------
Summary of the bug:
How to reproduce:
{{{
AVFormatContext* fmt_ctx = NULL;
avformat_open_input(&fmt_ctx, "/usr/bin/ntpd", NULL, NULL);
}}}
In my system an attempt to read /usr/bin/ntpd yields "Operation not
permitted", however at this point FFMPEG has already tentatively decided
that this is a dv input stream. See below:
{{{
ffprobe version n4.2 Copyright (c) 2007-2019 the FFmpeg developers
built with gcc 9.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-
stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl
--enable-ladspa --enable-libaom --enable-libass --enable-libbluray
--enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi
--enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug
--enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb
--enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr
--enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2
--enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2
--enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-
shared --enable-version3
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[dv @ 0x556a892d7640] Format dv detected only with low score of 25,
misdetection possible!
[dv @ 0x556a892d7640] Can't determine profile of DV input stream.
/usr/bin/ntpd: Operation not permitted
}}}
Since file operations are not permitted, avformat_open_input bails out but
does not fully free the allocated format context. LeakSanitizer reports a
single allocation leak around 32000 bytes.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8230>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list