avformat/matroskadec: Check pre_ns

Fixes: division by 0
Fixes: 44615/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6681108677263360

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 710e51677a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2022-02-13 15:20:02 +01:00
parent 93445cbbf4
commit f79f5a97bd
1 changed files with 2 additions and 0 deletions

View File

@ -4064,6 +4064,8 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
// prebuffered. // prebuffered.
pre_bytes = desc_end.end_offset - desc_end.start_offset; pre_bytes = desc_end.end_offset - desc_end.start_offset;
pre_ns = desc_end.end_time_ns - desc_end.start_time_ns; pre_ns = desc_end.end_time_ns - desc_end.start_time_ns;
if (pre_ns <= 0)
return -1;
pre_sec = pre_ns / nano_seconds_per_second; pre_sec = pre_ns / nano_seconds_per_second;
prebuffer_bytes += prebuffer_bytes +=
pre_bytes * ((temp_prebuffer_ns / nano_seconds_per_second) / pre_sec); pre_bytes * ((temp_prebuffer_ns / nano_seconds_per_second) / pre_sec);