[FFmpeg-devel] [PATCH 3/7] avformat/av1dec: check size before addition in probing

Michael Niedermayer michael at niedermayer.cc
Fri Nov 6 01:11:06 EET 2020


Fixes: signed integer overflow: 175 + 2147483571 cannot be represented in type 'int'
Fixes: 26833/clusterfuzz-testcase-minimized-ffmpeg_dem_IMAGE2_fuzzer-5969501214212096

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/av1dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
index 395eef6522..5ae81b34d4 100644
--- a/libavformat/av1dec.c
+++ b/libavformat/av1dec.c
@@ -361,7 +361,7 @@ static int obu_probe(const AVProbeData *p)
         ret = read_obu_with_size(p->buf + cnt, p->buf_size - cnt, &obu_size, &type);
         if (ret < 0 || obu_size <= 0)
             return 0;
-        cnt += ret;
+        cnt += FFMIN(ret, p->buf_size - cnt);
 
         ret = get_score(type, &seq);
         if (ret >= 0)
-- 
2.17.1



More information about the ffmpeg-devel mailing list