diff mbox

[FFmpeg-devel] avcodec/vp3: Error out on invalid num_coeffs in unpack_vlcs()

Message ID 20180211023854.7348-1-michael@niedermayer.cc
State Accepted
Commit f2318aee8ca8df1c84092f7d6691a2d0df02c474
Headers show

Commit Message

Michael Niedermayer Feb. 11, 2018, 2:38 a.m. UTC
This fixes a hypothetical integer overflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/vp3.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Feb. 11, 2018, 4:18 p.m. UTC | #1
On Sun, Feb 11, 2018 at 03:38:54AM +0100, Michael Niedermayer wrote:
> This fixes a hypothetical integer overflow
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vp3.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply and backport soon and then make a new release from 3.4


[...]
diff mbox

Patch

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 33be345c14..1d83753314 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -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      =