diff mbox series

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

Message ID 20200912181855.29304-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/arbc: Assume that at least one segment has a tile | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer Sept. 12, 2020, 6:18 p.m. UTC
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@niedermayer.cc>
---
 libavcodec/arbc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Sept. 12, 2020, 10:41 p.m. UTC | #1
On Sat, Sep 12, 2020 at 08:18:54PM +0200, Michael Niedermayer wrote:
> 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@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
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Again fix for timeouts that may break valid files.
diff mbox series

Patch

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)