diff mbox series

[FFmpeg-devel,2/2] avformat/dxa: Use av_rescale() for duration computation

Message ID 20200902213949.9768-2-michael@niedermayer.cc
State Accepted
Commit c313089fbe1df71b5406dd9d7e4d36361051c620
Headers show
Series [FFmpeg-devel,1/2] avcodec/vc1_block: Fix integer overflow in ac value | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer Sept. 2, 2020, 9:39 p.m. UTC
Fixes: signed integer overflow: 8224000000 * 1629552639 cannot be represented in type 'long'
Fixes: 24908/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4658478506049536

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

Comments

Michael Niedermayer Sept. 30, 2020, 8:35 p.m. UTC | #1
On Wed, Sep 02, 2020 at 11:39:49PM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 8224000000 * 1629552639 cannot be represented in type 'long'
> Fixes: 24908/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4658478506049536
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/dxa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 27fa6afb6a..909c5ba2ba 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -143,7 +143,7 @@  static int dxa_read_header(AVFormatContext *s)
     c->readvid = !c->has_sound;
     c->vidpos  = avio_tell(pb);
     s->start_time = 0;
-    s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den;
+    s->duration = av_rescale(c->frames, AV_TIME_BASE * (int64_t)num, den);
     av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames);
 
     return 0;