[FFmpeg-cvslog] shorten: Prevent block size from increasing

Laurent Aimar git at videolan.org
Mon Jun 4 12:51:31 CEST 2012


ffmpeg | branch: release/0.6 | Laurent Aimar <fenrir at elivagar.org> | Sun Oct  2 00:48:12 2011 +0000| [8f924ee66ff38e8758e404bac9d7cbd4c5676df8] | committer: Reinhard Tartler

shorten: Prevent block size from increasing

Signed-off-by: Janne Grunau <janne-libav at jannau.net>
(cherry picked from commit 95010d18b2d808db9a49377e41bc2f7cf4dfa03e)

Signed-off-by: Anton Khirnov <anton at khirnov.net>
(cherry picked from commit 22949c42edf5352c5fa8c43870efe20698432b35)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavcodec/shorten.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 934da8e..833a817 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -486,9 +486,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;



More information about the ffmpeg-cvslog mailing list