diff mbox series

[FFmpeg-devel] avformat/jacosubdec: Check for min in t overflow in get_shift()

Message ID 20210605143014.17686-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avformat/jacosubdec: Check for min in t overflow in get_shift()
Related show


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 June 5, 2021, 2:30 p.m. UTC
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 34651/clusterfuzz-testcase-minimized-ffmpeg_dem_JACOSUB_fuzzer-5157941012463616

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


diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index c8bded02fe..1224d35bc4 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -141,6 +141,9 @@  static int get_shift(int timeres, const char *buf)
     int n = sscanf(buf, "%d"SSEP"%d"SSEP"%d"SSEP"%d", &a, &b, &c, &d);
 #undef SSEP
+    if (a == INT_MIN)
+        return 0;
     if (*buf == '-' || a < 0) {
         sign = -1;
         a = FFABS(a);