[FFmpeg-cvslog] avcodec/cavsdec: Check bits left before picture allocation

Michael Niedermayer git at videolan.org
Mon May 1 02:04:45 EEST 2023


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Apr 24 00:15:04 2023 +0200| [e734e165442b4bf1598b167c373928d993371f0d] | committer: Michael Niedermayer

avcodec/cavsdec: Check bits left before picture allocation

Fixes: Timeout
Fixes: 57893/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CAVS_fuzzer-5091726540013568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e734e165442b4bf1598b167c373928d993371f0d
---

 libavcodec/cavsdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index b1fa9a981d..37071dfbc7 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -1020,6 +1020,9 @@ static int decode_pic(AVSContext *h)
             skip_bits(&h->gb, 1); //marker_bit
     }
 
+    if (get_bits_left(&h->gb) < 23)
+        return AVERROR_INVALIDDATA;
+
     ret = ff_get_buffer(h->avctx, h->cur.f, h->cur.f->pict_type == AV_PICTURE_TYPE_B ?
                         0 : AV_GET_BUFFER_FLAG_REF);
     if (ret < 0)



More information about the ffmpeg-cvslog mailing list