Skip to content

Commit

Permalink
avcodec/vp3: Error out on invalid num_coeffs in unpack_vlcs()
Browse files Browse the repository at this point in the history
This fixes a hypothetical integer overflow

Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Feb 11, 2018
1 parent 63a4bdb commit f2318ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libavcodec/vp3.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,11 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
Vp3Fragment *all_fragments = s->all_fragments;
VLC_TYPE(*vlc_table)[2] = table->table;

if (num_coeffs < 0)
if (num_coeffs < 0) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid number of coefficients at level %d\n", coeff_index);
return AVERROR_INVALIDDATA;
}

if (eob_run > num_coeffs) {
coeff_i =
Expand Down

0 comments on commit f2318ae

Please sign in to comment.