diff mbox series

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

Message ID 20201105231110.7772-3-michael@niedermayer.cc
State Accepted
Commit 76b6c46a81f420ffa04211d4b598547f14b67cb7
Headers show
Series [FFmpeg-devel,1/7,RFC] Revert "avcodec/adpcm_swf: support decoding multiple fixed-sized blocks at once"
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Michael Niedermayer Nov. 5, 2020, 11:11 p.m. UTC
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@niedermayer.cc>
---
 libavformat/av1dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Dec. 6, 2020, 4:36 p.m. UTC | #1
On Fri, Nov 06, 2020 at 12:11:06AM +0100, Michael Niedermayer wrote:
> 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@niedermayer.cc>
> ---
>  libavformat/av1dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply
diff mbox series

Patch

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)