diff mbox series

[FFmpeg-devel,12/12] avformat/samidec: Sanity check pts

Message ID 20210131191818.17203-12-michael@niedermayer.cc
State Accepted
Commit 2014b0135293c41d261757bfa1aaba51653bab8e
Headers show
Series [FFmpeg-devel,01/12] avcodec/hevc_sei: Check payload size in decode_nal_sei_message() | 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. 31, 2021, 7:18 p.m. UTC
Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long'
Fixes: 29743/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-5499256859394048

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

Patch

diff --git a/libavformat/samidec.c b/libavformat/samidec.c
index 3070ef9bac..cf5076c7b8 100644
--- a/libavformat/samidec.c
+++ b/libavformat/samidec.c
@@ -95,6 +95,11 @@  static int sami_read_header(AVFormatContext *s)
                 const char *p = ff_smil_get_attr_ptr(buf.str, "Start");
                 sub->pos      = pos;
                 sub->pts      = p ? strtol(p, NULL, 10) : 0;
+                if (sub->pts <= INT64_MIN/2 || sub->pts >= INT64_MAX/2) {
+                    res = AVERROR_PATCHWELCOME;
+                    goto end;
+                }
+
                 sub->duration = -1;
             }
         }