diff mbox series

[FFmpeg-devel,9/9] avcodec/wavpackenc: Use unsigned for potential 31bit shift

Message ID 20240519024915.1944150-9-michael@niedermayer.cc
State Accepted
Commit 6f976db251864ad698c935130370774783bf12f4
Headers show
Series [FFmpeg-devel,1/9] avcodec/vqcdec: Check init_get_bits8() for failure | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer May 19, 2024, 2:49 a.m. UTC
Fixes: CID1465481 Unintentional integer overflow

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

Comments

Michael Niedermayer June 2, 2024, 7:08 p.m. UTC | #1
On Sun, May 19, 2024 at 04:49:15AM +0200, Michael Niedermayer wrote:
> Fixes: CID1465481 Unintentional integer overflow
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/wavpackenc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply the 2 wavpack* patches

[...]
diff mbox series

Patch

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index ba0371592d9..e99ab951d41 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -1979,7 +1979,7 @@  static void encode_flush(WavPackEncodeContext *s)
                 put_bits(pb, 31, 0x7FFFFFFF);
                 cbits -= 31;
             } else {
-                put_bits(pb, cbits, (1 << cbits) - 1);
+                put_bits(pb, cbits, (1U << cbits) - 1);
                 cbits = 0;
             }
         } while (cbits);
@@ -2008,7 +2008,7 @@  static void encode_flush(WavPackEncodeContext *s)
                     put_bits(pb, 31, 0x7FFFFFFF);
                     cbits -= 31;
                 } else {
-                    put_bits(pb, cbits, (1 << cbits) - 1);
+                    put_bits(pb, cbits, (1U << cbits) - 1);
                     cbits = 0;
                 }
             } while (cbits);