[FFmpeg-cvslog] avcodec/vp3: Check version in all cases when VP4 code is not built

Michael Niedermayer git at videolan.org
Fri Apr 8 01:30:59 EEST 2022


ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Tue Nov 30 19:46:17 2021 +0100| [a8e6ddb5df5e3188aaac0ea9f4d4fd2b0beceb59] | committer: Michael Niedermayer

avcodec/vp3: Check version in all cases when VP4 code is not built

Fixes: out of array read
Fixes: 40284/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-4599568176644096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross at xvid.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 96caa01f130526cb420d0706a40fb63695153128)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/vp3.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 0611632d6d..a7fadadf49 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2748,7 +2748,14 @@ static int vp3_decode_frame(AVCodecContext *avctx,
             skip_bits(&gb, 4); /* width code */
             skip_bits(&gb, 4); /* height code */
             if (s->version) {
-                s->version = get_bits(&gb, 5);
+                int version = get_bits(&gb, 5);
+#if !CONFIG_VP4_DECODER
+                if (version >= 2) {
+                    av_log(avctx, AV_LOG_ERROR, "This build does not support decoding VP4.\n");
+                    return AVERROR_DECODER_NOT_FOUND;
+                }
+#endif
+                s->version = version;
                 if (avctx->frame_number == 0)
                     av_log(s->avctx, AV_LOG_DEBUG,
                            "VP version: %d\n", s->version);



More information about the ffmpeg-cvslog mailing list