[FFmpeg-devel] [PATCH]Avoid null pointer dereference on oom after duration_error allocation

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Jul 10 00:09:13 CEST 2013


Hi!

Also found while testing ticket #2566.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 17dcb25..da52422 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2855,6 +2855,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
 
                 if (!st->info->duration_error)
                     st->info->duration_error = av_mallocz(sizeof(st->info->duration_error[0])*2);
+                if (!st->info->duration_error)
+                    return AVERROR(ENOMEM);
 
 //                 if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
 //                     av_log(NULL, AV_LOG_ERROR, "%f\n", dts);


More information about the ffmpeg-devel mailing list