diff mbox series

[FFmpeg-devel,6/7] avformat/dsfdec: Change order of operations in bitrate computation

Message ID 20210423175056.24019-6-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/7] avformat/asfdec_o: shrink extradata to the initialized size
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer April 23, 2021, 5:50 p.m. UTC
Fixes: signed integer overflow: 538976288 * 67372036 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_DSF_fuzzer-6751696819716096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/dsfdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/dsfdec.c b/libavformat/dsfdec.c
index 2fca25ef32..7681c917c5 100644
--- a/libavformat/dsfdec.c
+++ b/libavformat/dsfdec.c
@@ -129,7 +129,7 @@  static int dsf_read_header(AVFormatContext *s)
         return AVERROR_INVALIDDATA;
     }
     st->codecpar->block_align *= st->codecpar->channels;
-    st->codecpar->bit_rate = st->codecpar->channels * st->codecpar->sample_rate * 8LL;
+    st->codecpar->bit_rate = st->codecpar->channels * 8LL * st->codecpar->sample_rate;
     avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
     avio_skip(pb, 4);