1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

avformat/utils: check for integer overflow in av_get_frame_filename2()

Fixes: signed integer overflow: 317316873 * 10 cannot be represented in type 'int'
Fixes: 24708/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5731180885049344

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 03c479ce23)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-08-15 22:52:42 +02:00
parent a8d260b66a
commit b9570ed6f3

View File

@ -4691,8 +4691,11 @@ int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number
if (c == '%') { if (c == '%') {
do { do {
nd = 0; nd = 0;
while (av_isdigit(*p)) while (av_isdigit(*p)) {
if (nd >= INT_MAX / 10 - 255)
goto fail;
nd = nd * 10 + *p++ - '0'; nd = nd * 10 + *p++ - '0';
}
c = *p++; c = *p++;
} while (av_isdigit(c)); } while (av_isdigit(c));