Browse code

Check if buffer is large enough for given resolution. Fixes issue 2501.

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

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

Daniel Kang authored on 2011/01/08 06:54:52
Showing 1 changed files
... ...
@@ -54,6 +54,11 @@ static int decode_frame(AVCodecContext *avctx,
54 54
     if(p->data[0])
55 55
         avctx->release_buffer(avctx, p);
56 56
 
57
+    if(buf_size/avctx->height < avctx->width) {
58
+        av_log(avctx, AV_LOG_ERROR, "Resolution larger than buffer size. Invalid header?\n");
59
+        return -1;
60
+    }
61
+
57 62
     p->reference= 0;
58 63
     if(avctx->get_buffer(avctx, p) < 0){
59 64
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");