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@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit cd847f86d3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2022-07-03 00:43:21 +02:00
parent 0b999775a0
commit d79de91f1e
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 1 additions and 1 deletions

View File

@ -369,7 +369,7 @@ static int decode_frame(AVCodecContext *avctx,
bytestream2_skip(&gbc, 18); bytestream2_skip(&gbc, 18);
colors = bytestream2_get_be16(&gbc); colors = bytestream2_get_be16(&gbc);
if (colors < 0 || colors > 256) { if (colors < 0 || colors > 255) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
"Error color count - %i(0x%X)\n", colors, colors); "Error color count - %i(0x%X)\n", colors, colors);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;