summaryrefslogtreecommitdiff
path: root/libavcodec/sgidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-01-12 00:16:01 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2023-01-12 15:29:03 +0100
commit9f0602a717c3939529bfe49734f3d8029dc36625 (patch)
treeb0642387f893654f873d991080170d4277e10e33 /libavcodec/sgidec.c
parentfc263f073ed3cb4082194b594ffeb4dfce6a2c5d (diff)
avcodec/sgidec: do not forget the number of components in read_uncompressed_sgi()
Fixes: out of array access Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGI_fuzzer-6704753329700864 Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGI_fuzzer-6683986844057600 Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGI_fuzzer-6697387691474944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/sgidec.c')
-rw-r--r--libavcodec/sgidec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index 6ff2ee97f6..92083f23de 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -159,7 +159,7 @@ static int read_uncompressed_sgi(uint8_t *const out[4], const ptrdiff_t stride[4
unsigned rowsize = width * bytes_per_channel;
/* Test buffer size. */
- if (rowsize * (int64_t)height > bytestream2_get_bytes_left(g))
+ if (rowsize * (int64_t)height * nb_components > bytestream2_get_bytes_left(g))
return AVERROR_INVALIDDATA;
for (unsigned z = 0; z < nb_components; z++) {