avcodec/cavsdec: Check esc_code

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-05-14 17:54:40 +02:00
parent 729466dc68
commit 139e1c8009
1 changed files with 5 additions and 0 deletions

View File

@ -563,6 +563,11 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
return AVERROR_INVALIDDATA;
}
esc_code = get_ue_code(gb, esc_golomb_order);
if (esc_code < 0 || esc_code > 32767) {
av_log(h->avctx, AV_LOG_ERROR, "esc_code invalid\n");
return AVERROR_INVALIDDATA;
}
level = esc_code + (run > r->max_run ? 1 : r->level_add[run]);
while (level > r->inc_limit)
r++;