[FFmpeg-cvslog] Prevent block size from inreasing in the shorten decoder.

Laurent Aimar git at videolan.org
Sun Nov 6 20:18:54 CET 2011


ffmpeg | branch: release/0.5 | Laurent Aimar <fenrir at elivagar.org> | Sat Oct  1 00:43:05 2011 +0200| [1a6f024520d667a9fbf63e701cc029a6d556d76e] | committer: Michael Niedermayer

Prevent block size from inreasing in the shorten decoder.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit b399cbfba5d901608c18e1a2d48a24c30541a634)
(cherry picked from commit 55a96a984ec65736475a8577a158abc5c48fd50a)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index f8d2ff9..6aacd5c 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -469,9 +469,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