avformat/tedcaptionsdec: Check for overflow in parse_int()
Fixes: signed integer overflow: 1111111111111111111 * 10 cannot be represented in type 'long'
Fixes: 26892/clusterfuzz-testcase-minimized-ffmpeg_dem_TEDCAPTIONS_fuzzer-5756045055754240
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b0f8586ca9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
220eaaf6b6
commit
9e1fede231
1 changed files with 2 additions and 0 deletions
|
|
@ -181,6 +181,8 @@ static int parse_int(AVIOContext *pb, int *cur_byte, int64_t *result)
|
|||
if ((unsigned)*cur_byte - '0' > 9)
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (BETWEEN(*cur_byte, '0', '9')) {
|
||||
if (val > INT_MAX/10 - (*cur_byte - '0'))
|
||||
return AVERROR_INVALIDDATA;
|
||||
val = val * 10 + (*cur_byte - '0');
|
||||
next_byte(pb, cur_byte);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue