aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-01-11 23:26:06 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2023-06-04 20:18:16 +0200
commit3b39e8a3b8c62184fdc33e0337db1ab0c4dc0b90 (patch)
tree8c572c73a65662de23c05d55b5510c91dfd9f4e5
parenta928367cba8b732320b0a07d07559ccd0f9f48d0 (diff)
downloadffmpeg-3b39e8a3b8c62184fdc33e0337db1ab0c4dc0b90.tar.gz
avcodec/pngdec: Check deloco index more exactly
Fixes: out of array access: Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PNG_fuzzer-6716193709096960 Alternatively it should be possible to limit this to 3 plane RGB 8 /16bit to ensure the size is what it should be 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 d5bae704068dc37191280e024eecb8d02b762b28) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/pngdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 1196e1a010..ce570e3d55 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -308,7 +308,7 @@ static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type,
static void deloco_ ## NAME(TYPE *dst, int size, int alpha) \
{ \
int i; \
- for (i = 0; i < size; i += 3 + alpha) { \
+ for (i = 0; i < size - 2; i += 3 + alpha) { \
int g = dst [i + 1]; \
dst[i + 0] += g; \
dst[i + 2] += g; \