avformat/iff: simplify duration calculation

Fixes: signed integer overflow: 315680096256 * 134215943 cannot be represented in type 'long long'
Fixes: 48713/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5886272312311808

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 0740641e93)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2022-07-04 23:32:40 +02:00
parent 3ca6eeff77
commit 86cbbd66cd
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 3 additions and 2 deletions

View File

@ -385,7 +385,7 @@ static int read_dst_frame(AVFormatContext *s, AVPacket *pkt)
avio_skip(pb, 1); avio_skip(pb, 1);
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
pkt->stream_index = 0; pkt->stream_index = 0;
pkt->duration = 588LL * s->streams[0]->codecpar->sample_rate / 44100; pkt->duration = s->streams[0]->codecpar->sample_rate / 75;
pkt->pos = chunk_pos; pkt->pos = chunk_pos;
chunk_pos = avio_tell(pb); chunk_pos = avio_tell(pb);
@ -398,7 +398,8 @@ static int read_dst_frame(AVFormatContext *s, AVPacket *pkt)
case ID_FRTE: case ID_FRTE:
if (data_size < 4) if (data_size < 4)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
s->streams[0]->duration = avio_rb32(pb) * 588LL * s->streams[0]->codecpar->sample_rate / 44100; s->streams[0]->duration = avio_rb32(pb) * (uint64_t)s->streams[0]->codecpar->sample_rate / 75;
break; break;
} }