mirror of
https://github.com/php/php-src.git
synced 2024-12-13 20:05:26 +08:00
ext/sodium: Avoid shifts wider than 32 bits on size_t values
Backport from PECL libsodium-php 2.0.10
This commit is contained in:
parent
c25b1a7e8c
commit
d057458166
@ -3405,7 +3405,8 @@ PHP_FUNCTION(sodium_pad)
|
|||||||
for (j = 0U; j <= xpadded_len; j++) {
|
for (j = 0U; j <= xpadded_len; j++) {
|
||||||
ZSTR_VAL(padded)[j] = unpadded[i];
|
ZSTR_VAL(padded)[j] = unpadded[i];
|
||||||
k -= st;
|
k -= st;
|
||||||
st = (~(((((k >> 48) | (k >> 32) | (k >> 16) | k) & 0xffff) - 1U) >> 16)) & 1U;
|
st = (size_t) (~(((( (((uint64_t) k) >> 48) | (((uint64_t) k) >> 32) |
|
||||||
|
(k >> 16) | k) & 0xffff) - 1U) >> 16)) & 1U;
|
||||||
i += st;
|
i += st;
|
||||||
}
|
}
|
||||||
#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
|
#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
|
||||||
|
Loading…
Reference in New Issue
Block a user