mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
avformat/jacosubdec: avoid signed integer overflows in get_shift()
Fixes: signed integer overflow: 22014562800 * 934633746 cannot be represented in type 'long' Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_JACOSUB_fuzzer-5189603246866432 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
6490b9aed6
commit
32447b149f
@ -124,7 +124,7 @@ shift_and_ret:
|
||||
return buf + len;
|
||||
}
|
||||
|
||||
static int get_shift(int timeres, const char *buf)
|
||||
static int get_shift(unsigned timeres, const char *buf)
|
||||
{
|
||||
int sign = 1;
|
||||
int a = 0, b = 0, c = 0, d = 0;
|
||||
@ -148,7 +148,11 @@ static int get_shift(int timeres, const char *buf)
|
||||
case 3: d = c; c = b; b = a; a = 0;
|
||||
}
|
||||
|
||||
ret = sign * (((int64_t)a*3600 + (int64_t)b*60 + c) * timeres + d);
|
||||
ret = (int64_t)a*3600 + (int64_t)b*60 + c;
|
||||
if (FFABS(ret) > (INT64_MAX - FFABS(d)) / timeres)
|
||||
return 0;
|
||||
ret = sign * (ret * timeres + d);
|
||||
|
||||
if ((int)ret != ret)
|
||||
ret = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user