avcodec/scpr: check for possible out of array access
authorPaul B Mahol <onemda@gmail.com>
Mon, 2 Apr 2018 06:59:20 +0000 (08:59 +0200)
committerPaul B Mahol <onemda@gmail.com>
Mon, 2 Apr 2018 07:02:25 +0000 (09:02 +0200)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/scpr.c

index ad6073d..3c797d5 100644 (file)
@@ -211,6 +211,10 @@ static int decode_value(SCPRContext *s, unsigned *cnt, unsigned maxc, unsigned s
             break;
         c++;
     }
+
+    if (c >= maxc)
+        return AVERROR_INVALIDDATA;
+
     if ((ret = s->decode(gb, rc, cumfr, cnt_c, totfr)) < 0)
         return ret;