From 0097177d24a2bfb4b1ec1334f157ed6e83f11666 Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Thu, 15 Oct 2026 21:33:31 +0200 Subject: [PATCH] Fix -Wtautological-constant-out-of-range-compare in ext/sodium on 32-bit sodium_crypto_aead_aes256gcm_decrypt() compares a size_t against a 64 GiB limit, which clang reports as always false where size_t is 32-bit. Cast to unsigned long long first, as the other AEAD length checks already do. --- ext/sodium/libsodium.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c index f54d35506ab1..0d237aed6add 100644 --- a/ext/sodium/libsodium.c +++ b/ext/sodium/libsodium.c @@ -1860,7 +1860,7 @@ PHP_FUNCTION(sodium_crypto_aead_aes256gcm_decrypt) if (ciphertext_len < crypto_aead_aes256gcm_ABYTES) { RETURN_FALSE; } - if (ciphertext_len - crypto_aead_aes256gcm_ABYTES > 16ULL * ((1ULL << 32) - 2ULL)) { + if ((unsigned long long) ciphertext_len - crypto_aead_aes256gcm_ABYTES > 16ULL * ((1ULL << 32) - 2ULL)) { zend_argument_error(sodium_exception_ce, 1, "is too long"); RETURN_THROWS(); }