summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/jrand48.c
diff options
context:
space:
mode:
authorkenjiro <>2025-07-17 00:55:48 +0000
committerkenjiro <>2025-07-17 00:55:48 +0000
commit904ebeb7f3b2f0d375bada0148d4f4a954efffa7 (patch)
tree406b1b3531c309d7d0efb18765105366f6728880 /src/lib/libc/stdlib/jrand48.c
parente4f0420dbabca7343337c5408a5a98dfbec303bd (diff)
downloadopenbsd-904ebeb7f3b2f0d375bada0148d4f4a954efffa7.tar.gz
openbsd-904ebeb7f3b2f0d375bada0148d4f4a954efffa7.tar.bz2
openbsd-904ebeb7f3b2f0d375bada0148d4f4a954efffa7.zip
avoid undefined behavior when shifting into sign bit
Shifting a signed int64_t into the sign bit is undefined behavior in C. /dev/portable/crypto/curve25519/curve25519.c:3900:18: runtime error: left shift of negative value -222076011 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /dev/portable To avoid this, import int64_lshift21() from BoringSSL, a helper function that casts the input to uint64_t before shifting and back to int64_t afterward. This ensures defined behavior when shifting left by 21 bits, avoiding undefined behavior in expressions like `carry << 21`. This change addresses potential runtime issues detected by sanitizers when shifting signed values with high bits set. ok tb beck
Diffstat (limited to 'src/lib/libc/stdlib/jrand48.c')
0 files changed, 0 insertions, 0 deletions