mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-09-19 21:06:42 +00:00
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 dfa5d1a366
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
6bfec5efc4
commit
08e46a341a
@ -171,6 +171,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;
|
||||
|
Loading…
Reference in New Issue
Block a user