aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-08-15 22:52:42 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-11 21:23:48 +0200
commit13c058d51cea4d82acbc0ad9761a7cb853daea17 (patch)
tree8b28e7c1843de3d42ccca88eb1f6b2622fab50d0 /libavformat/utils.c
parent3cd7db6c4f99071df4d06aa8ee862fef5bc32e4b (diff)
downloadffmpeg-13c058d51cea4d82acbc0ad9761a7cb853daea17.tar.gz
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 03c479ce236955fc329c7f9f4765ee1ec256bb73) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 9ff6284dfb..fef57a26cf 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4582,8 +4582,11 @@ int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number
if (c == '%') {
do {
nd = 0;
- while (av_isdigit(*p))
+ while (av_isdigit(*p)) {
+ if (nd >= INT_MAX / 10 - 255)
+ goto fail;
nd = nd * 10 + *p++ - '0';
+ }
c = *p++;
} while (av_isdigit(c));