diff mbox series

[FFmpeg-devel,1/5] avformat/sccdec: Use larger intermediate for ts/next_ts computation

Message ID 20210117225311.17297-1-michael@niedermayer.cc
State Accepted
Commit 92b194919199e6ea978ff6e120e9f9034b2bd299
Headers show
Series [FFmpeg-devel,1/5] avformat/sccdec: Use larger intermediate for ts/next_ts computation | expand

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 Jan. 17, 2021, 10:53 p.m. UTC
Fixes: signed integer overflow: 92237203 * 33 cannot be represented in type 'int'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SCC_fuzzer-6603769487949824

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

Comments

Michael Niedermayer Feb. 2, 2021, 10:58 a.m. UTC | #1
On Sun, Jan 17, 2021 at 11:53:07PM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 92237203 * 33 cannot be represented in type 'int'
> Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SCC_fuzzer-6603769487949824
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/sccdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libavformat/sccdec.c b/libavformat/sccdec.c
index 751dee7c6c..1786520944 100644
--- a/libavformat/sccdec.c
+++ b/libavformat/sccdec.c
@@ -93,7 +93,7 @@  static int scc_read_header(AVFormatContext *s)
                     break;
             }
 
-            ts = (hh * 3600LL + mm * 60LL + ss) * 1000LL + fs * 33;
+            ts = (hh * 3600LL + mm * 60LL + ss) * 1000LL + fs * 33LL;
 
             while (!ff_text_eof(&tr)) {
                 len = ff_subtitles_read_line(&tr, line2, sizeof(line2));
@@ -117,7 +117,7 @@  static int scc_read_header(AVFormatContext *s)
             }
         }
 
-        next_ts = (hh * 3600LL + mm * 60LL + ss) * 1000LL + fs * 33;
+        next_ts = (hh * 3600LL + mm * 60LL + ss) * 1000LL + fs * 33LL;
 
         pos = ff_text_pos(&tr);
         lline = (char *)&line;