Commit e20ebe49 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/shorten: check bitshift

Fixes invalid shift
Fixes CID1194400
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent b2cfd1fd
...@@ -505,9 +505,16 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data, ...@@ -505,9 +505,16 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
while (len--) while (len--)
get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE); get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
break; break;
case FN_BITSHIFT: case FN_BITSHIFT: {
s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE); unsigned bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
if (bitshift > 31) {
av_log(avctx, AV_LOG_ERROR, "bitshift %d is invalid\n",
bitshift);
return AVERROR_PATCHWELCOME;
}
s->bitshift = bitshift;
break; break;
}
case FN_BLOCKSIZE: { case FN_BLOCKSIZE: {
unsigned blocksize = get_uint(s, av_log2(s->blocksize)); unsigned blocksize = get_uint(s, av_log2(s->blocksize));
if (blocksize > s->blocksize) { if (blocksize > s->blocksize) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment