[FFmpeg-cvslog] avcodec/qdrw: adjust max colors to array size

Michael Niedermayer git at videolan.org
Fri Oct 28 22:16:45 EEST 2022


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jul  3 00:43:21 2022 +0200| [bafac17227a5757af3d9ead9ac9bef5330254a31] | committer: Michael Niedermayer

avcodec/qdrw: adjust max colors to array size

Fixes: out of array access
Fixes: 48429/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDRAW_fuzzer-4608329791438848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit cd847f86d31f87f0f7733ca6ab7a2c022a1398bd)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/qdrw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index a7ea45fced..b41eefa790 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -216,7 +216,7 @@ static int decode_frame(AVCodecContext *avctx,
             bytestream2_skip(&gbc, 18);
             colors = bytestream2_get_be16(&gbc);
 
-            if (colors < 0 || colors > 256) {
+            if (colors < 0 || colors > 255) {
                 av_log(avctx, AV_LOG_ERROR,
                        "Error color count - %i(0x%X)\n", colors, colors);
                 return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list