avformat/imx: Check palette chunk size

Fixes: out of array write
Fixes: 32116/clusterfuzz-testcase-minimized-ffmpeg_dem_SIMBIOSIS_IMX_fuzzer-6702533894602752

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-03-30 12:47:22 +02:00
parent 497ea04dbd
commit f7a5150447
1 changed files with 2 additions and 0 deletions

View File

@ -113,6 +113,8 @@ retry:
imx->first_video_packet_pos = pos;
break;
case 0xAA98:
if (chunk_size > 256 * 3)
return AVERROR_INVALIDDATA;
for (int i = 0; i < chunk_size / 3; i++) {
unsigned r = avio_r8(pb) << 18;
unsigned g = avio_r8(pb) << 10;