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>
... | ... |
@@ -180,6 +180,10 @@ static int cmap_read_palette(AVCodecContext *avctx, uint32_t *pal) |
180 | 180 |
pal[i] = 0xFF000000 | gray2rgb((i * 255) >> avctx->bits_per_coded_sample); |
181 | 181 |
} |
182 | 182 |
if (s->masking == MASK_HAS_MASK) { |
183 |
+ if ((1 << avctx->bits_per_coded_sample) < count) { |
|
184 |
+ avpriv_request_sample(avctx, "overlapping mask"); |
|
185 |
+ return AVERROR_PATCHWELCOME; |
|
186 |
+ } |
|
183 | 187 |
memcpy(pal + (1 << avctx->bits_per_coded_sample), pal, count * 4); |
184 | 188 |
for (i = 0; i < count; i++) |
185 | 189 |
pal[i] &= 0xFFFFFF; |