Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix GH-16168: php 8.1 and earlier crash immediately when compiled with Xcode 16 clang on macOS 15
This commit is contained in:
Niels Dossche 2024-10-11 09:14:26 +02:00
commit 5b0b151bb2
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
2 changed files with 22 additions and 20 deletions

2
NEWS
View file

@ -8,6 +8,8 @@ PHP NEWS
- Core: - Core:
. Fixed bug OSS-Fuzz #371445205 (Heap-use-after-free in attr_free). . Fixed bug OSS-Fuzz #371445205 (Heap-use-after-free in attr_free).
(nielsdos) (nielsdos)
. Fixed bug GH-16168 (php 8.1 and earlier crash immediately when compiled
with Xcode 16 clang on macOS 15). (nielsdos)
- Curl: - Curl:
. Fixed bug GH-16302 (CurlMultiHandle holds a reference to CurlHandle if . Fixed bug GH-16302 (CurlMultiHandle holds a reference to CurlHandle if

View file

@ -402,32 +402,32 @@ ZEND_API bool ZEND_FASTCALL I_REPLACE_SONAME_FNNAME_ZU(NONE,zend_string_equal_va
ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2) ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2)
{ {
const char *ptr = ZSTR_VAL(s1); const char *ptr = ZSTR_VAL(s1);
size_t delta = (const char*)s2 - (const char*)s1; uintptr_t delta = (uintptr_t) s2 - (uintptr_t) s1;
size_t len = ZSTR_LEN(s1); size_t len = ZSTR_LEN(s1);
zend_ulong ret; zend_ulong ret;
__asm__ ( __asm__ (
".LL0%=:\n\t" "0:\n\t"
"movl (%2,%3), %0\n\t" "movl (%2,%3), %0\n\t"
"xorl (%2), %0\n\t" "xorl (%2), %0\n\t"
"jne .LL1%=\n\t" "jne 1f\n\t"
"addl $0x4, %2\n\t" "addl $0x4, %2\n\t"
"subl $0x4, %1\n\t" "subl $0x4, %1\n\t"
"ja .LL0%=\n\t" "ja 0b\n\t"
"movl $0x1, %0\n\t" "movl $0x1, %0\n\t"
"jmp .LL3%=\n\t" "jmp 3f\n\t"
".LL1%=:\n\t" "1:\n\t"
"cmpl $0x4,%1\n\t" "cmpl $0x4,%1\n\t"
"jb .LL2%=\n\t" "jb 2f\n\t"
"xorl %0, %0\n\t" "xorl %0, %0\n\t"
"jmp .LL3%=\n\t" "jmp 3f\n\t"
".LL2%=:\n\t" "2:\n\t"
"negl %1\n\t" "negl %1\n\t"
"lea 0x20(,%1,8), %1\n\t" "lea 0x20(,%1,8), %1\n\t"
"shll %b1, %0\n\t" "shll %b1, %0\n\t"
"sete %b0\n\t" "sete %b0\n\t"
"movzbl %b0, %0\n\t" "movzbl %b0, %0\n\t"
".LL3%=:\n" "3:\n"
: "=&a"(ret), : "=&a"(ret),
"+c"(len), "+c"(len),
"+r"(ptr) "+r"(ptr)
@ -440,32 +440,32 @@ ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const
ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2) ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2)
{ {
const char *ptr = ZSTR_VAL(s1); const char *ptr = ZSTR_VAL(s1);
size_t delta = (const char*)s2 - (const char*)s1; uintptr_t delta = (uintptr_t) s2 - (uintptr_t) s1;
size_t len = ZSTR_LEN(s1); size_t len = ZSTR_LEN(s1);
zend_ulong ret; zend_ulong ret;
__asm__ ( __asm__ (
".LL0%=:\n\t" "0:\n\t"
"movq (%2,%3), %0\n\t" "movq (%2,%3), %0\n\t"
"xorq (%2), %0\n\t" "xorq (%2), %0\n\t"
"jne .LL1%=\n\t" "jne 1f\n\t"
"addq $0x8, %2\n\t" "addq $0x8, %2\n\t"
"subq $0x8, %1\n\t" "subq $0x8, %1\n\t"
"ja .LL0%=\n\t" "ja 0b\n\t"
"movq $0x1, %0\n\t" "movq $0x1, %0\n\t"
"jmp .LL3%=\n\t" "jmp 3f\n\t"
".LL1%=:\n\t" "1:\n\t"
"cmpq $0x8,%1\n\t" "cmpq $0x8,%1\n\t"
"jb .LL2%=\n\t" "jb 2f\n\t"
"xorq %0, %0\n\t" "xorq %0, %0\n\t"
"jmp .LL3%=\n\t" "jmp 3f\n\t"
".LL2%=:\n\t" "2:\n\t"
"negq %1\n\t" "negq %1\n\t"
"lea 0x40(,%1,8), %1\n\t" "lea 0x40(,%1,8), %1\n\t"
"shlq %b1, %0\n\t" "shlq %b1, %0\n\t"
"sete %b0\n\t" "sete %b0\n\t"
"movzbq %b0, %0\n\t" "movzbq %b0, %0\n\t"
".LL3%=:\n" "3:\n"
: "=&a"(ret), : "=&a"(ret),
"+c"(len), "+c"(len),
"+r"(ptr) "+r"(ptr)