diff mbox series

[FFmpeg-devel,6/7] avformat/realtextdec: Avoid undefined overflow in the end of read_ts()

Message ID 20210116230729.30613-6-michael@niedermayer.cc
State Accepted
Commit aa1b8e6898f861cc065c3b0fe315e826a324d0a9
Headers show
Series [FFmpeg-devel,1/7] avformat/mpsubdec: Use av_sat_add/sub64() in fracval handling
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 Jan. 16, 2021, 11:07 p.m. UTC
Fixes: signed integer overflow: 234080282628234040 * 100 cannot be represented in type 'long long'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_REALTEXT_fuzzer-6649867065753600

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

Comments

Michael Niedermayer Jan. 26, 2021, 4:47 p.m. UTC | #1
On Sun, Jan 17, 2021 at 12:07:28AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 234080282628234040 * 100 cannot be represented in type 'long long'
> Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_REALTEXT_fuzzer-6649867065753600
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/realtextdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c
index 390f8ddc67..f534774420 100644
--- a/libavformat/realtextdec.c
+++ b/libavformat/realtextdec.c
@@ -54,7 +54,7 @@  static int64_t read_ts(const char *s)
     if (sscanf(s,    "%u:%u.%u",      &mm, &ss, &ms) == 3) return (            mm*60LL + ss) * 100LL + ms;
     if (sscanf(s,    "%u:%u"   ,      &mm, &ss     ) == 2) return (            mm*60LL + ss) * 100LL;
     if (sscanf(s,       "%u.%u",           &ss, &ms) == 2) return (                      ss) * 100LL + ms;
-    return strtol(s, NULL, 10) * 100LL;
+    return strtoll(s, NULL, 10) * 100ULL;
 }
 
 static int realtext_read_header(AVFormatContext *s)