mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-13 18:40:03 +01:00
avformat/rpl: The associative law doesnt hold for signed integers in C
Add () to avoid undefined behavior
Fixes: signed integer overflow: 9223372036854775790 + 57 cannot be represented in type 'long'
Fixes: 34983/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-5765822923538432
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 480f11bdd7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -103,7 +103,7 @@ static AVRational read_fps(const char* line, int* error)
|
|||||||
// Truncate any numerator too large to fit into an int64_t
|
// Truncate any numerator too large to fit into an int64_t
|
||||||
if (num > (INT64_MAX - 9) / 10 || den > INT64_MAX / 10)
|
if (num > (INT64_MAX - 9) / 10 || den > INT64_MAX / 10)
|
||||||
break;
|
break;
|
||||||
num = 10 * num + *line - '0';
|
num = 10 * num + (*line - '0');
|
||||||
den *= 10;
|
den *= 10;
|
||||||
}
|
}
|
||||||
if (!num)
|
if (!num)
|
||||||
|
|||||||
Reference in New Issue
Block a user