aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-08-21 23:22:39 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-15 12:25:45 +0100
commit79e06f4d316b550c08749b43f0f5f29c1bdca56d (patch)
tree91684691fedad2c6f4248f8dabf7b9eaa7612b07
parent6d1f143ae128d02e68cbb7895ef6302e883c008d (diff)
downloadffmpeg-79e06f4d316b550c08749b43f0f5f29c1bdca56d.tar.gz
avcodec/iff: Check for overlap in cmap_read_palette()
Fixes: undefined memcpy() use Fixes: 16302/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5678750575886336 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 dfa5d1a3667fa38e07373becc2401175b31d8228) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/iff.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 459d5d4a55..1bb7924c98 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -180,6 +180,10 @@ static int cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
pal[i] = 0xFF000000 | gray2rgb((i * 255) >> avctx->bits_per_coded_sample);
}
if (s->masking == MASK_HAS_MASK) {
+ if ((1 << avctx->bits_per_coded_sample) < count) {
+ avpriv_request_sample(avctx, "overlapping mask");
+ return AVERROR_PATCHWELCOME;
+ }
memcpy(pal + (1 << avctx->bits_per_coded_sample), pal, count * 4);
for (i = 0; i < count; i++)
pal[i] &= 0xFFFFFF;