mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Fix the crypt sha apis build (with recent clang versions).
Removing the said subtraction by casting instead. While at it fixing werror level on phpdbg too. Closes #8897.
This commit is contained in:
parent
d66d477d6f
commit
b3569865b3
3
NEWS
3
NEWS
@ -17,6 +17,9 @@ PHP NEWS
|
||||
. Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php
|
||||
syntaxe of a valid file). (Dmitry)
|
||||
|
||||
- Standard:
|
||||
. Fixed the crypt_sha256/512 api build with clang > 12. (David Carier)
|
||||
|
||||
07 Jul 2022, PHP 8.0.21
|
||||
|
||||
- Core:
|
||||
|
@ -371,15 +371,15 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b
|
||||
salt_len = MIN(strcspn(salt, "$"), SALT_LEN_MAX);
|
||||
key_len = strlen(key);
|
||||
|
||||
if ((key - (char *) 0) % __alignof__ (uint32_t) != 0) {
|
||||
if ((uintptr_t)key % __alignof__ (uint32_t) != 0) {
|
||||
char *tmp = (char *) alloca(key_len + __alignof__(uint32_t));
|
||||
key = copied_key = memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % __alignof__(uint32_t), key, key_len);
|
||||
key = copied_key = memcpy(tmp + __alignof__(uint32_t) - (uintptr_t)tmp % __alignof__(uint32_t), key, key_len);
|
||||
}
|
||||
|
||||
if ((salt - (char *) 0) % __alignof__(uint32_t) != 0) {
|
||||
if ((uintptr_t)salt % __alignof__(uint32_t) != 0) {
|
||||
char *tmp = (char *) alloca(salt_len + 1 + __alignof__(uint32_t));
|
||||
salt = copied_salt =
|
||||
memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % __alignof__ (uint32_t), salt, salt_len);
|
||||
memcpy(tmp + __alignof__(uint32_t) - (uintptr_t)tmp % __alignof__ (uint32_t), salt, salt_len);
|
||||
copied_salt[salt_len] = 0;
|
||||
}
|
||||
|
||||
|
@ -405,15 +405,15 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
|
||||
salt_len = MIN(strcspn(salt, "$"), SALT_LEN_MAX);
|
||||
key_len = strlen(key);
|
||||
|
||||
if ((key - (char *) 0) % __alignof__ (uint64_t) != 0) {
|
||||
if ((uintptr_t)key % __alignof__ (uint64_t) != 0) {
|
||||
char *tmp = (char *) alloca (key_len + __alignof__ (uint64_t));
|
||||
key = copied_key =
|
||||
memcpy(tmp + __alignof__(uint64_t) - (tmp - (char *) 0) % __alignof__(uint64_t), key, key_len);
|
||||
memcpy(tmp + __alignof__(uint64_t) - (uintptr_t)tmp % __alignof__(uint64_t), key, key_len);
|
||||
}
|
||||
|
||||
if ((salt - (char *) 0) % __alignof__ (uint64_t) != 0) {
|
||||
if ((uintptr_t)salt % __alignof__ (uint64_t) != 0) {
|
||||
char *tmp = (char *) alloca(salt_len + 1 + __alignof__(uint64_t));
|
||||
salt = copied_salt = memcpy(tmp + __alignof__(uint64_t) - (tmp - (char *) 0) % __alignof__(uint64_t), salt, salt_len);
|
||||
salt = copied_salt = memcpy(tmp + __alignof__(uint64_t) - (uintptr_t)tmp % __alignof__(uint64_t), salt, salt_len);
|
||||
copied_salt[salt_len] = 0;
|
||||
}
|
||||
|
||||
|
@ -910,7 +910,7 @@ static ssize_t phpdbg_stdiop_write(php_stream *stream, const char *buf, size_t c
|
||||
while (data->fd >= 0) {
|
||||
struct stat stat[3];
|
||||
memset(stat, 0, sizeof(stat));
|
||||
if (((fstat(fileno(stderr), &stat[2]) < 0) & (fstat(fileno(stdout), &stat[0]) < 0)) | (fstat(data->fd, &stat[1]) < 0)) {
|
||||
if (((fstat(fileno(stderr), &stat[2]) < 0) && (fstat(fileno(stdout), &stat[0]) < 0)) || (fstat(data->fd, &stat[1]) < 0)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user