[FFmpeg-devel] [PATCH 5/7] avformat/utils: Move +1 to avoid overflow
Michael Niedermayer
michael at niedermayer.cc
Mon Oct 19 17:24:59 EEST 2020
Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
Fixes: Timeout
Fixes: 26434/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5752845451919360
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavformat/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index a2e701ea1a..49ccc91b82 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -253,7 +253,7 @@ int ffio_limit(AVIOContext *s, int size)
remaining= FFMAX(remaining, 0);
}
- if (s->maxsize>= 0 && remaining+1 < size) {
+ if (s->maxsize>= 0 && remaining < size - (int64_t)1) {
av_log(NULL, remaining ? AV_LOG_ERROR : AV_LOG_DEBUG, "Truncating packet of size %d to %"PRId64"\n", size, remaining+1);
size = remaining+1;
}
--
2.17.1
More information about the ffmpeg-devel
mailing list