From: Adhemerval Zanella Date: Tue, 22 Apr 2025 17:28:35 +0000 (-0300) Subject: string: Fix UB on gneric stpcpy X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=925d03df27356314d53db76709a1c3435c57598e;p=thirdparty%2Fglibc.git string: Fix UB on gneric stpcpy Building with ubsan it trigger: UBSAN: Undefined behaviour in ../string/stpcpy.c:91:12 shift exponent 56 is too large for 32-bit type 'int' Use an unsigned constant literal for MERGE, since op_t is defined as unsigned. --- diff --git a/string/stpcpy.c b/string/stpcpy.c index 214802266c..0fe1b99192 100644 --- a/string/stpcpy.c +++ b/string/stpcpy.c @@ -88,7 +88,7 @@ stpcpy_unaligned_loop (op_t *restrict dst, const op_t *restrict src, } /* Align the final partial of P2. */ - w2 = MERGE (w2b, sh_1, 0, sh_2); + w2 = MERGE (w2b, sh_1, 0UL, sh_2); } out: