diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-09-17 21:48:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-10-09 21:33:08 +0200 |
commit | bf1893f342b02e7920f6760516f4fa86ddce2a15 (patch) | |
tree | d39865d6eae4e59fb032016654f8be5c8a231050 | |
parent | 0c56afb8d6c28d98ed9d4d373d6461c0921ac382 (diff) | |
download | ffmpeg-bf1893f342b02e7920f6760516f4fa86ddce2a15.tar.gz |
avformat/cafdec: Check that nb_frasmes fits within 64bit
Fixes: signed integer overflow: 1099511693312 * 538976288 cannot be represented in type 'long'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6565048815845376
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 d4bb4e375975dc0d31d5309106cf6ee0ed75140f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/cafdec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index f0fd326fb6..b1db03a893 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -344,7 +344,7 @@ static int read_header(AVFormatContext *s) found_data: if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) { - if (caf->data_size > 0) + if (caf->data_size > 0 && caf->data_size / caf->bytes_per_packet < INT64_MAX / caf->frames_per_packet) st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet; } else if (st->nb_index_entries && st->duration > 0) { if (st->codecpar->sample_rate && caf->data_size / st->duration > INT64_MAX / st->codecpar->sample_rate / 8) { |