[FFmpeg-devel] [PATCH] NULL-check Matroska chapters when reading header

Justin Jacobs jajdorkster at gmail.com
Thu Aug 7 02:29:40 CEST 2014


I have a Matroska file that contains a broken chapter (end time is before
start time) that caused any ffmpeg-linked program to crash when accessing
it. I've attached a patch that fixes the crash. Also, here is the backtrace
of the crash for reference:

(gdb) backtrace
#0  av_dict_set (pm=0x20, key=0x7ffff0bd14ef "title", value=0x7fffd80107e0
"The End", flags=0) at libavutil/dict.c:71
#1  0x00007ffff0b0e220 in matroska_read_header (s=0x20) at
libavformat/matroskadec.c:2164
#2  0x00007ffff0b9b233 in avformat_open_input (ps=0x7fffe00c1a08,
filename=<optimized out>, fmt=<optimized out>, options=0x0) at
libavformat/utils.c:599
#3  0x00007ffff5fc9c32 in
ffmpegthumbnailer::MovieDecoder::initialize(std::string const&) () from
/usr/lib/libffmpegthumbnailer.so.4
#4  0x00007ffff5fcd50f in
ffmpegthumbnailer::VideoThumbnailer::generateThumbnail(std::string const&,
ffmpegthumbnailer::ImageWriter&, AVFormatContext*) ()
   from /usr/lib/libffmpegthumbnailer.so.4
#5  0x00007ffff5fcd911 in
ffmpegthumbnailer::VideoThumbnailer::generateThumbnail(std::string const&,
ThumbnailerImageTypeEnum, std::string const&, AVFormatContext*) ()
   from /usr/lib/libffmpegthumbnailer.so.4
#6  0x00007ffff5fce636 in video_thumbnailer_generate_thumbnail_to_file ()
from /usr/lib/libffmpegthumbnailer.so.4
#7  0x00000000004314e5 in ?? ()
#8  0x00000000004319a0 in ?? ()
#9  0x000000000042221f in ?? ()
#10 0x00000000004310bb in ?? ()
#11 0x0000000000430dd0 in ?? ()
#12 0x00007ffff644ec95 in ?? () from /usr/lib/libglib-2.0.so.0
#13 0x00007ffff5766124 in start_thread () from /usr/lib/libpthread.so.0
#14 0x00007ffff549a4bd in clone () from /usr/lib/libc.so.6

Thanks,
Justin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-NULL-check-Matroska-chapters-when-reading-header.patch
Type: text/x-patch
Size: 1101 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140806/6fb2ca3d/attachment.bin>


More information about the ffmpeg-devel mailing list