summaryrefslogtreecommitdiff
path: root/libavcodec/shorten.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@elivagar.org>2011-10-02 00:48:12 +0000
committerJanne Grunau <janne-libav@jannau.net>2011-10-07 16:25:30 +0200
commit95010d18b2d808db9a49377e41bc2f7cf4dfa03e (patch)
tree6a504c5cb9ffa6602bcaf800911a6f4a453ce33a /libavcodec/shorten.c
parent124a16f678ddcffe8f1825efb29a6e8da1d580ac (diff)
shorten: Prevent block size from increasing
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
Diffstat (limited to 'libavcodec/shorten.c')
-rw-r--r--libavcodec/shorten.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 80b1b4dba5..8f7436e0a9 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -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;