From 22a878ecd1c1d67ea985e998d9c0493795b86427 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Mon, 2 Apr 2018 08:59:20 +0200 Subject: [PATCH] avcodec/scpr: check for possible out of array access Signed-off-by: Paul B Mahol --- libavcodec/scpr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c index ad6073dbf0..3c797d55f5 100644 --- a/libavcodec/scpr.c +++ b/libavcodec/scpr.c @@ -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;