aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-02-13 15:20:02 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-03-28 23:13:19 +0200
commitbcc5755ae3a87092dd5e87b8fb949725eafba689 (patch)
treec096a8041b155616824dc819b9627a349b6f1dc8
parent16372498b53f85844233381ee1a4de6ae3b26287 (diff)
downloadffmpeg-bcc5755ae3a87092dd5e87b8fb949725eafba689.tar.gz
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 710e51677a6f3a5c2b37dc31a597957a22a5e531) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/matroskadec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 3ba8ef9b68..dc310c0ad1 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3369,6 +3369,8 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
// prebuffered.
pre_bytes = desc_end.end_offset - desc_end.start_offset;
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;
prebuffer_bytes +=
pre_bytes * ((temp_prebuffer_ns / nano_seconds_per_second) / pre_sec);