diff mbox series

[FFmpeg-devel] avformat/jpegxl_probe: Fix potential incorrect and UB shift

Message ID AS8PR01MB7944B2B7C55BC5B66E95DD888FFD9@AS8PR01MB7944.eurprd01.prod.exchangelabs.com
State Accepted
Commit 3946cb02fc67a0fdd23ff9e0678b2801fe479463
Headers show
Series [FFmpeg-devel] avformat/jpegxl_probe: Fix potential incorrect and UB shift | 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
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Andreas Rheinhardt April 28, 2022, 3:10 a.m. UTC
Fixes Coverity issue #1504273.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/jpegxl_probe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/jpegxl_probe.c b/libavformat/jpegxl_probe.c
index 924b529ad5..9cd00da194 100644
--- a/libavformat/jpegxl_probe.c
+++ b/libavformat/jpegxl_probe.c
@@ -96,10 +96,10 @@  static uint64_t jpegxl_u64(GetBitContext *gb)
         ret = jxl_bits(12);
         while (jxl_bits(1)) {
             if (shift < 60) {
-                ret |= jxl_bits(8) << shift;
+                ret |= (uint64_t)jxl_bits(8) << shift;
                 shift += 8;
             } else {
-                ret |= jxl_bits(4) << shift;
+                ret |= (uint64_t)jxl_bits(4) << shift;
                 break;
             }
         }