[FFmpeg-devel] [PATCH]Fix null pointer dereference on audio probing
Carl Eugen Hoyos
cehoyos at ag.or.at
Sat Jun 29 01:45:11 CEST 2013
On Friday 28 June 2013 05:40:29 pm Michael Niedermayer wrote:
> On Fri, Jun 28, 2013 at 04:01:38PM +0200, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached patch fixes - analog to 41f3c60 - a null pointer dereference if
> > oom occurs while probing audio, should fix ticket #2722.
> >
> > Please comment, Carl Eugen
>
> probably ok
Alternative patch attached, which one do you prefer?
Thank you, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 71fca24..8587fc9 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2674,9 +2674,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
//try to just open decoders, in case this is enough to get parameters
if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) {
- if (codec && !st->codec->codec)
- avcodec_open2(st->codec, codec, options ? &options[i]
+ if (codec && !st->codec->codec) {
+ ret = avcodec_open2(st->codec, codec, options ? &options[i]
: &thread_opt);
+ if (ret == AVERROR(ENOMEM)) {
+ goto find_stream_info_err;
+ } else {
+ ret = 0;
+ }
+ }
}
if (!options)
av_dict_free(&thread_opt);
More information about the ffmpeg-devel
mailing list