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

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Apr 28 06:10:55 EEST 2022


Fixes Coverity issue #1504273.

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

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;
             }
         }
-- 
2.32.0



More information about the ffmpeg-devel mailing list