[FFmpeg-devel] [PATCH]Fix crash on OOM

Michael Niedermayer michaelni at gmx.at
Thu Jun 27 01:58:41 CEST 2013


On Thu, Jun 27, 2013 at 12:18:25AM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes a null-pointer-dereference in avcodec_decode_video2() 
> because of OOM as reported in ticket 1900.
> 
> Please comment, Carl Eugen

>  utils.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> d16ec6e33fa14763a8fbe35c4b7300e24ae93348  patchoom.diff
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 71fca24..4f14429 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2674,9 +2674,12 @@ 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 < 0)
> +                    goto find_stream_info_err;
> +            }
>          }
>          if (!options)
>              av_dict_free(&thread_opt);

failure of one decoder to open should not cause failure of the other
streams

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130627/d1bbf3db/attachment.asc>


More information about the ffmpeg-devel mailing list