avcodec/vp3: Error out on invalid num_coeffs in unpack_vlcs()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 11 Feb 2018 02:38:54 +0000 (03:38 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 11 Feb 2018 16:20:17 +0000 (17:20 +0100)
This fixes a hypothetical integer overflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/vp3.c

index 33be345..1d83753 100644 (file)
@@ -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      =