Module: Mesa
Branch: main
Commit: 1492d24f89f6e156d83d6f579d1d308eaae996ef
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1492d24f89f6e156d83d6f579d1d308eaae996ef

Author: Eric Engestrom <[email protected]>
Date:   Sun Nov 26 11:22:28 2023 +0000

lp: make sure 0xff is unsigned before shifting it past signed int range

src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c:2446:82: runtime error: left 
shift of 255 by 24 places cannot be represented in type 'int'

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26368>

---

 src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c 
b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
index a3ac235a5fe..2215f2434c1 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
@@ -2443,7 +2443,7 @@ rgtc1_to_rgba_aos(struct gallivm_state *gallivm,
    memset(&type8, 0, sizeof type8);
    type8.width = 8;
    type8.length = n*4;
-   rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : 
(0xff << 24));
+   rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : 
(0xffu << 24));
    rgba = LLVMBuildOr(builder, rgba, red, "");
    return LLVMBuildBitCast(builder, rgba, lp_build_vec_type(gallivm, type8), 
"");
 }
@@ -2471,7 +2471,7 @@ rgtc2_to_rgba_aos(struct gallivm_state *gallivm,
    memset(&type8, 0, sizeof type8);
    type8.width = 8;
    type8.length = n*4;
-   rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : 
(0xff << 24));
+   rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : 
(0xffu << 24));
    rgba = LLVMBuildOr(builder, rgba, red, "");
    green = LLVMBuildShl(builder, green, lp_build_const_int_vec(gallivm, type, 
8), "");
    rgba = LLVMBuildOr(builder, rgba, green, "");
@@ -2498,7 +2498,7 @@ latc1_to_rgba_aos(struct gallivm_state *gallivm,
    memset(&type8, 0, sizeof type8);
    type8.width = 8;
    type8.length = n*4;
-   rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : 
(0xff << 24));
+   rgba = lp_build_const_int_vec(gallivm, type, is_signed ? (0x7f << 24) : 
(0xffu << 24));
    rgba = LLVMBuildOr(builder, rgba, red, "");
    temp = LLVMBuildShl(builder, red, lp_build_const_int_vec(gallivm, type, 8), 
"");
    rgba = LLVMBuildOr(builder, rgba, temp, "");

Reply via email to