[FFmpeg-devel] [PATCH 1/2] avcodec/arbc: Assume that at least one segment has a tile

Michael Niedermayer michael at niedermayer.cc
Sat Sep 12 21:18:54 EEST 2020


If no segment has a tile, the segment count really should be 0
Fixes: Timeout (61sec -> 2sec)
Fixes: 25445/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARBC_fuzzer-5657711222718464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/arbc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/arbc.c b/libavcodec/arbc.c
index 06970f140b..9d8284df2b 100644
--- a/libavcodec/arbc.c
+++ b/libavcodec/arbc.c
@@ -133,7 +133,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
     if (nb_segments == 0)
         return avpkt->size;
 
-    if (7 * nb_segments > bytestream2_get_bytes_left(&s->gb))
+    if (7 * nb_segments + 6 > bytestream2_get_bytes_left(&s->gb))
         return AVERROR_INVALIDDATA;
 
     if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
-- 
2.17.1



More information about the ffmpeg-devel mailing list