mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-04-11 03:32:39 +00:00
avformat/icodec: Check nb_pal
Fixes: signed integer overflow: 538976288 * 4 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-6690068904935424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
9303ba272e
commit
db73ae0dc1
@ -196,6 +196,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
AV_WL32(buf + 32, image->nb_pal);
|
AV_WL32(buf + 32, image->nb_pal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (image->nb_pal > INT_MAX / 4 - 14 - 40)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4);
|
AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4);
|
||||||
AV_WL32(buf + 8, AV_RL32(buf + 8) / 2);
|
AV_WL32(buf + 8, AV_RL32(buf + 8) / 2);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user