changeset 5088:5da0e7ccc3c4 libavformat

Check for failed extradata malloc, fixes a crash in out-of-memory conditions or with extremely large extradata.
author reimar
date Fri, 03 Jul 2009 11:27:52 +0000
parents 5de39afaca2e
children a8f6dd9abf72
files avidec.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/avidec.c	Fri Jul 03 11:26:14 2009 +0000
+++ b/avidec.c	Fri Jul 03 11:27:52 2009 +0000
@@ -483,6 +483,10 @@
                     if(size > 10*4 && size<(1<<30)){
                         st->codec->extradata_size= size - 10*4;
                         st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+                        if (!st->codec->extradata) {
+                            st->codec->extradata_size= 0;
+                            return AVERROR(ENOMEM);
+                        }
                         get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
                     }