diff mbox series

[FFmpeg-devel,1/3] avcodec/dpx: fix off by 1 in bits_per_color check

Message ID 20210516193901.30853-1-michael@niedermayer.cc
State Accepted
Commit ca9025f374e4c4632a8a1be623304b78ba6435f6
Headers show
Series [FFmpeg-devel,1/3] avcodec/dpx: fix off by 1 in bits_per_color check | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer May 16, 2021, 7:38 p.m. UTC
Fixes: CID1476303 Bad bit shift operation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/dpx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer June 8, 2021, 3:52 p.m. UTC | #1
On Sun, May 16, 2021 at 09:38:59PM +0200, Michael Niedermayer wrote:
> Fixes: CID1476303 Bad bit shift operation
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/dpx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

[...]
diff mbox series

Patch

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)) &&