mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/matroskadec: Check desc_bytes
Fixes: Division by 0
Fixes: 44035/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4826721386364928
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 5038933977
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2edb753825
commit
7eebf00ff0
|
@ -3850,12 +3850,16 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
|
||||||
do {
|
do {
|
||||||
int64_t desc_bytes = desc_end.end_offset - desc_beg.start_offset;
|
int64_t desc_bytes = desc_end.end_offset - desc_beg.start_offset;
|
||||||
int64_t desc_ns = desc_end.end_time_ns - desc_beg.start_time_ns;
|
int64_t desc_ns = desc_end.end_time_ns - desc_beg.start_time_ns;
|
||||||
double desc_sec = desc_ns / nano_seconds_per_second;
|
double desc_sec, calc_bits_per_second, percent, mod_bits_per_second;
|
||||||
double calc_bits_per_second = (desc_bytes * 8) / desc_sec;
|
if (desc_bytes <= 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
desc_sec = desc_ns / nano_seconds_per_second;
|
||||||
|
calc_bits_per_second = (desc_bytes * 8) / desc_sec;
|
||||||
|
|
||||||
// Drop the bps by the percentage of bytes buffered.
|
// Drop the bps by the percentage of bytes buffered.
|
||||||
double percent = (desc_bytes - prebuffer_bytes) / desc_bytes;
|
percent = (desc_bytes - prebuffer_bytes) / desc_bytes;
|
||||||
double mod_bits_per_second = calc_bits_per_second * percent;
|
mod_bits_per_second = calc_bits_per_second * percent;
|
||||||
|
|
||||||
if (prebuffer < desc_sec) {
|
if (prebuffer < desc_sec) {
|
||||||
double search_sec =
|
double search_sec =
|
||||||
|
|
Loading…
Reference in New Issue