From: Tim Kientzle Date: Fri, 8 May 2026 04:50:50 +0000 (-0700) Subject: [test_utils] Fix a minor UB X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e46e2c389a60084182a26a7f2bfefc1d2bec031b;p=thirdparty%2Flibarchive.git [test_utils] Fix a minor UB (UBSan occasionally finds something interesting and often reports whacky non-bugs like this one. "Fixing" it will make the real UB bugs easier to identify, so...) According to C's integer promotion rules, `unsigned short` gets promoted to _signed_ `int`, and shifting into the sign bit of an `int` is technically UB. Explicit cast to `unsigned` quiets UBSan. --- diff --git a/test_utils/test_utils.c b/test_utils/test_utils.c index be717f4cc..a24b0272c 100644 --- a/test_utils/test_utils.c +++ b/test_utils/test_utils.c @@ -149,7 +149,7 @@ unsigned int i4le(const void* p_) { const char *p = p_; - return (i2le(p) | (i2le(p + 2) << 16)); + return (i2le(p) | ((unsigned int)i2le(p + 2) << 16)); } unsigned long long i8le(const void* p_)