mirror of
https://github.com/librempeg/librempeg
synced 2024-11-23 11:39:47 +00:00
ape_decode_value_3860: check k before using it in get_bits()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
8937230719
commit
60ab448042
@ -489,9 +489,12 @@ static inline int ape_decode_value_3860(APEContext *ctx, GetBitContext *gb,
|
||||
|
||||
if (!rice->k)
|
||||
x = overflow;
|
||||
else
|
||||
else if(rice->k <= MIN_CACHE_BITS) {
|
||||
x = (overflow << rice->k) + get_bits(gb, rice->k);
|
||||
|
||||
} else {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", rice->k);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
rice->ksum += x - (rice->ksum + 8 >> 4);
|
||||
if (rice->ksum < (rice->k ? 1 << (rice->k + 4) : 0))
|
||||
rice->k--;
|
||||
|
Loading…
Reference in New Issue
Block a user