diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-05-16 19:44:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-06-08 18:00:05 +0200 |
commit | ca9025f374e4c4632a8a1be623304b78ba6435f6 (patch) | |
tree | c565d4e656b8e82292709af1cb9e6ad3a64d5a26 | |
parent | a0a4a527c3b0819368d9b148542bb7663f39df79 (diff) | |
download | ffmpeg-ca9025f374e4c4632a8a1be623304b78ba6435f6.tar.gz |
avcodec/dpx: fix off by 1 in bits_per_color check
Fixes: CID1476303 Bad bit shift operation
Fixes: 34871/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DPX_fuzzer-6331163028357120
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/dpx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index 8e77c09bb1..3563bdc538 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -242,7 +242,7 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_PATCHWELCOME; } - if (bits_per_color > 32) + if (bits_per_color > 31) return AVERROR_INVALIDDATA; buf += 820; @@ -319,7 +319,7 @@ static int decode_frame(AVCodecContext *avctx, minCV = av_int2float(i); maxCV = av_int2float(j); if (bits_per_color >= 1 && - minCV == 0.0f && maxCV == ((1<<bits_per_color) - 1)) { + minCV == 0.0f && maxCV == ((1U<<bits_per_color) - 1)) { avctx->color_range = AVCOL_RANGE_JPEG; } else if (bits_per_color >= 8 && minCV == (1 <<(bits_per_color - 4)) && |