[FFmpeg-cvslog] avcodec/scpr: Test bx before use
Michael Niedermayer
git at videolan.org
Fri May 26 19:19:56 EEST 2023
ffmpeg | branch: release/4.1 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jan 8 20:03:40 2023 +0100| [dd507e4c8f1596ae3d84eec2477532fef0d046df] | committer: Michael Niedermayer
avcodec/scpr: Test bx before use
Fixes: out of array access on 32bit
Fixes: 54850/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5302669294305280
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 1b59de3770b2e3f7f44ec4adba27c88b79adaaec)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd507e4c8f1596ae3d84eec2477532fef0d046df
---
libavcodec/scpr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index 297fb315e2..a2d5bb6514 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -592,6 +592,9 @@ static int decompress_p(AVCodecContext *avctx,
int run, z, bx = x * 16 + sx1, by = y * 16 + sy1;
unsigned r, g, b, clr, ptype = 0;
+ if (bx >= avctx->width)
+ return AVERROR_INVALIDDATA;
+
for (; by < y * 16 + sy2 && by < avctx->height;) {
ret = decode_value(s, s->op_model[ptype], 6, 1000, &ptype);
if (ret < 0)
More information about the ffmpeg-cvslog
mailing list