summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@elivagar.org>2011-10-01 00:43:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-02 03:24:17 +0200
commitb399cbfba5d901608c18e1a2d48a24c30541a634 (patch)
tree84ee94d31d01e4a6a5c451edf1f858013c05fe7b
parent581898ae882dc37967b689b6ea5f2b2a9acd257a (diff)
Prevent block size from inreasing in the shorten decoder.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/shorten.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index f46b21fc8e..ebc429036f 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;