1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

avformat/cafdec: Do not build an index if all packets are the same

Fixes: Timeout
Fixes: 28214/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6495999421579264

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-04 19:21:35 +01:00
parent 558426b847
commit ea12590c8e

View File

@ -204,6 +204,10 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
st->nb_frames += avio_rb32(pb); /* priming frames */
st->nb_frames += avio_rb32(pb); /* remainder frames */
if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) {
st->duration = caf->frames_per_packet * num_packets;
pos = caf-> bytes_per_packet * num_packets;
} else {
st->duration = 0;
for (i = 0; i < num_packets; i++) {
if (avio_feof(pb))
@ -214,6 +218,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
pos += caf->bytes_per_packet ? caf->bytes_per_packet : ff_mp4_read_descr_len(pb);
st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);
}
}
if (avio_tell(pb) - ccount > size) {
av_log(s, AV_LOG_ERROR, "error reading packet table\n");