From: Frank Denis Date: Thu, 21 Sep 2017 15:46:01 +0000 (+0200) Subject: ext/sodium: avoid negations on unsigned values X-Git-Tag: php-7.2.0RC3~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a52a61e3a51049a0ae5ef824ff575e2959abe20;p=php ext/sodium: avoid negations on unsigned values --- diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c index bb0aad46c5..8d02af577d 100644 --- a/ext/sodium/libsodium.c +++ b/ext/sodium/libsodium.c @@ -3284,7 +3284,7 @@ PHP_FUNCTION(sodium_unpad) is_barrier = (( (acc - 1U) & (pad_len - 1U) & ((c ^ 0x80) - 1U) ) >> 8) & 1U; acc |= c; - pad_len |= (i & - is_barrier); + pad_len |= i & (1U + ~is_barrier); valid |= (unsigned char) is_barrier; } unpadded_len = padded_len - 1U - pad_len;