Check if buffer is large enough for given resolution.
authorDaniel Kang <daniel.d.kang@gmail.com>
Fri, 7 Jan 2011 21:54:52 +0000 (21:54 +0000)
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>
Fri, 7 Jan 2011 21:54:52 +0000 (21:54 +0000)
Fixes issue 2501.

Patch by Daniel Kang, daniel.d.kang at gmail

Originally committed as revision 26258 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/cljr.c

index 47809c0..96c9bdf 100644 (file)
@@ -54,6 +54,11 @@ static int decode_frame(AVCodecContext *avctx,
     if(p->data[0])
         avctx->release_buffer(avctx, p);
 
+    if(buf_size/avctx->height < avctx->width) {
+        av_log(avctx, AV_LOG_ERROR, "Resolution larger than buffer size. Invalid header?\n");
+        return -1;
+    }
+
     p->reference= 0;
     if(avctx->get_buffer(avctx, p) < 0){
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");