[FFmpeg-devel] [PATCH 4/6] avcodec/qdrw: adjust max colors to array size

Michael Niedermayer michael at niedermayer.cc
Sun Jul 3 03:31:50 EEST 2022


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
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/qdrw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index 849d4a5cad..ff8f97713d 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -368,7 +368,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
             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;
-- 
2.17.1



More information about the ffmpeg-devel mailing list