Skip to content

Commit 26d63c7

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
2 parents af75eab + b356986 commit 26d63c7

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ PHP NEWS
1717
. Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php
1818
syntaxe of a valid file). (Dmitry)
1919

20+
- Standard:
21+
. Fixed the crypt_sha256/512 api build with clang > 12. (David Carier)
22+
2023
07 Jul 2022, PHP 8.1.8
2124

2225
- Core:

ext/standard/crypt_sha256.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,15 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b
371371
salt_len = MIN(strcspn(salt, "$"), SALT_LEN_MAX);
372372
key_len = strlen(key);
373373

374-
if ((key - (char *) 0) % __alignof__ (uint32_t) != 0) {
374+
if ((uintptr_t)key % __alignof__ (uint32_t) != 0) {
375375
char *tmp = (char *) alloca(key_len + __alignof__(uint32_t));
376-
key = copied_key = memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % __alignof__(uint32_t), key, key_len);
376+
key = copied_key = memcpy(tmp + __alignof__(uint32_t) - (uintptr_t)tmp % __alignof__(uint32_t), key, key_len);
377377
}
378378

379-
if ((salt - (char *) 0) % __alignof__(uint32_t) != 0) {
379+
if ((uintptr_t)salt % __alignof__(uint32_t) != 0) {
380380
char *tmp = (char *) alloca(salt_len + 1 + __alignof__(uint32_t));
381381
salt = copied_salt =
382-
memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % __alignof__ (uint32_t), salt, salt_len);
382+
memcpy(tmp + __alignof__(uint32_t) - (uintptr_t)tmp % __alignof__ (uint32_t), salt, salt_len);
383383
copied_salt[salt_len] = 0;
384384
}
385385

ext/standard/crypt_sha512.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,15 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
405405
salt_len = MIN(strcspn(salt, "$"), SALT_LEN_MAX);
406406
key_len = strlen(key);
407407

408-
if ((key - (char *) 0) % __alignof__ (uint64_t) != 0) {
408+
if ((uintptr_t)key % __alignof__ (uint64_t) != 0) {
409409
char *tmp = (char *) alloca (key_len + __alignof__ (uint64_t));
410410
key = copied_key =
411-
memcpy(tmp + __alignof__(uint64_t) - (tmp - (char *) 0) % __alignof__(uint64_t), key, key_len);
411+
memcpy(tmp + __alignof__(uint64_t) - (uintptr_t)tmp % __alignof__(uint64_t), key, key_len);
412412
}
413413

414-
if ((salt - (char *) 0) % __alignof__ (uint64_t) != 0) {
414+
if ((uintptr_t)salt % __alignof__ (uint64_t) != 0) {
415415
char *tmp = (char *) alloca(salt_len + 1 + __alignof__(uint64_t));
416-
salt = copied_salt = memcpy(tmp + __alignof__(uint64_t) - (tmp - (char *) 0) % __alignof__(uint64_t), salt, salt_len);
416+
salt = copied_salt = memcpy(tmp + __alignof__(uint64_t) - (uintptr_t)tmp % __alignof__(uint64_t), salt, salt_len);
417417
copied_salt[salt_len] = 0;
418418
}
419419

sapi/phpdbg/phpdbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ static ssize_t phpdbg_stdiop_write(php_stream *stream, const char *buf, size_t c
858858
while (data->fd >= 0) {
859859
struct stat stat[3];
860860
memset(stat, 0, sizeof(stat));
861-
if (((fstat(fileno(stderr), &stat[2]) < 0) & (fstat(fileno(stdout), &stat[0]) < 0)) | (fstat(data->fd, &stat[1]) < 0)) {
861+
if (((fstat(fileno(stderr), &stat[2]) < 0) && (fstat(fileno(stdout), &stat[0]) < 0)) || (fstat(data->fd, &stat[1]) < 0)) {
862862
break;
863863
}
864864

0 commit comments

Comments
 (0)