diff mbox series

[FFmpeg-devel,1/4] avformat/swfenc: Fix integer overflow in frame rate handling

Message ID 20200216194303.819-1-michael@niedermayer.cc
State Accepted
Commit 31f956acadd994b8c4e22b714aaffee0f527c827
Headers show
Series [FFmpeg-devel,1/4] avformat/swfenc: Fix integer overflow in frame rate handling | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Feb. 16, 2020, 7:43 p.m. UTC
Fixes: signed integer overflow: 30000299 * 256 cannot be represented in type 'int'
Fixes: ticket8184

Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/swfenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer May 21, 2020, 10:16 a.m. UTC | #1
On Sun, Feb 16, 2020 at 08:43:00PM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 30000299 * 256 cannot be represented in type 'int'
> Fixes: ticket8184
> 
> Found-by: Suhwan
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/swfenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index 84f924eda5..9da4aad959 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -256,7 +256,7 @@  static int swf_write_header(AVFormatContext *s)
         av_log(s, AV_LOG_ERROR, "Invalid (too large) frame rate %d/%d\n", rate, rate_base);
         return AVERROR(EINVAL);
     }
-    avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */
+    avio_wl16(pb, (rate * 256LL) / rate_base); /* frame rate */
     swf->duration_pos = avio_tell(pb);
     avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */