mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avformat/iff: More completely check body_size
Fixes: infinite loop
Fixes: 26485/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5126561373880320
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 3588e2e6b0
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
48fbee3b44
commit
e03a2c7106
@ -837,7 +837,7 @@ static int iff_read_packet(AVFormatContext *s,
|
|||||||
} else if (st->codecpar->codec_tag == ID_DST) {
|
} else if (st->codecpar->codec_tag == ID_DST) {
|
||||||
return read_dst_frame(s, pkt);
|
return read_dst_frame(s, pkt);
|
||||||
} else {
|
} else {
|
||||||
if (iff->body_size > INT_MAX)
|
if (iff->body_size > INT_MAX || !iff->body_size)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
ret = av_get_packet(pb, pkt, iff->body_size);
|
ret = av_get_packet(pb, pkt, iff->body_size);
|
||||||
}
|
}
|
||||||
@ -873,6 +873,8 @@ static int iff_read_packet(AVFormatContext *s,
|
|||||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||||
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
|
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
|
||||||
st->codecpar->codec_tag != ID_ANIM) {
|
st->codecpar->codec_tag != ID_ANIM) {
|
||||||
|
if (iff->body_size > INT_MAX || !iff->body_size)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
ret = av_get_packet(pb, pkt, iff->body_size);
|
ret = av_get_packet(pb, pkt, iff->body_size);
|
||||||
pkt->pos = pos;
|
pkt->pos = pos;
|
||||||
if (pos == iff->body_pos)
|
if (pos == iff->body_pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user