]> git.sesse.net Git - ffmpeg/commitdiff
Prevent block size from inreasing in the shorten decoder.
authorLaurent Aimar <fenrir@elivagar.org>
Fri, 30 Sep 2011 22:43:05 +0000 (00:43 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 2 Oct 2011 01:24:17 +0000 (03:24 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/shorten.c

index f46b21fc8e91bb1ae81edf7e2a177cc5ea18c18e..ebc429036f1ce2934ae60ac4bf5c7688c43d84cf 100644 (file)
@@ -482,9 +482,15 @@ static int shorten_decode_frame(AVCodecContext *avctx,
             case FN_BITSHIFT:
                 s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
                 break;
-            case FN_BLOCKSIZE:
-                s->blocksize = get_uint(s, av_log2(s->blocksize));
+            case FN_BLOCKSIZE: {
+                int blocksize = get_uint(s, av_log2(s->blocksize));
+                if (blocksize > s->blocksize) {
+                    av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n");
+                    return AVERROR_PATCHWELCOME;
+                }
+                s->blocksize = blocksize;
                 break;
+            }
             case FN_QUIT:
                 *data_size = 0;
                 return buf_size;