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

Michael Niedermayer git at videolan.org
Wed Oct 6 19:07:25 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun  3 22:26:41 2021 +0200| [d482bf35eb10393bd91c9bd447e839fffd84a1d8] | committer: Michael Niedermayer

avformat/jacosubdec: Check for min in t overflow in get_shift()

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 at niedermayer.cc>
(cherry picked from commit 989febfbd0c986e9e3e0f269a6b22778bf79147b)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d482bf35eb10393bd91c9bd447e839fffd84a1d8
---

 libavformat/jacosubdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 9c6640eef8..2ccbf4c9de 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);



More information about the ffmpeg-cvslog mailing list