[FFmpeg-cvslog] apedec: check for data buffer realloc failure

Justin Ruggles git at videolan.org
Sat Oct 29 02:31:37 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Tue Oct 11 12:47:11 2011 -0400| [11ca8b2d7486e879926488404b3b79af774f0f2d] | committer: Justin Ruggles

apedec: check for data buffer realloc failure

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=11ca8b2d7486e879926488404b3b79af774f0f2d
---

 libavcodec/apedec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index a754fd7..2041e2b 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -824,7 +824,10 @@ static int ape_decode_frame(AVCodecContext *avctx,
     }
 
     if(!s->samples){
-        s->data = av_realloc(s->data, (buf_size + 3) & ~3);
+        void *tmp_data = av_realloc(s->data, (buf_size + 3) & ~3);
+        if (!tmp_data)
+            return AVERROR(ENOMEM);
+        s->data = tmp_data;
         s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2);
         s->ptr = s->last_ptr = s->data;
         s->data_end = s->data + buf_size;



More information about the ffmpeg-cvslog mailing list