summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-01-16 00:01:13 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2023-04-21 01:55:12 +0200
commit1f8a4e35a1cfbaf4418a50505a31c0f2797a65ab (patch)
treef42ac3cc666c805a44608dc921da8f62083ff70d
parent85b4c5c10667d68130f11f601b139bdc10bb17b8 (diff)
downloadffmpeg-1f8a4e35a1cfbaf4418a50505a31c0f2797a65ab.tar.gz
avcodec/scpr3: Check bx
Fixes: Out of array access Fixes: 55102/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-4877396618903552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit cc7e984a05b28dcfaaaad95afa061be71b4ba7fc) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/scpr3.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/scpr3.c b/libavcodec/scpr3.c
index 1ed764baa1..f56ae19118 100644
--- a/libavcodec/scpr3.c
+++ b/libavcodec/scpr3.c
@@ -1184,6 +1184,9 @@ static int decompress_p3(AVCodecContext *avctx,
int run, bx = x * 16 + sx1, by = y * 16 + sy1;
uint32_t clr, ptype = 0, r, g, b;
+ if (bx >= avctx->width)
+ return AVERROR_INVALIDDATA;
+
for (; by < y * 16 + sy2 && by < avctx->height;) {
ret = decode_value3(s, 5, &s->op_model3[ptype].cntsum,
s->op_model3[ptype].freqs[0],