Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix NULL arithmetic in System V shared memory emulation
This commit is contained in:
Christoph M. Becker 2025-01-25 18:58:40 +01:00
commit 5c066e04b2
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
2 changed files with 14 additions and 11 deletions

1
NEWS
View file

@ -19,6 +19,7 @@ PHP NEWS
. Fixed bug GH-17408 (Assertion failure Zend/zend_exceptions.c).
(nielsdos, ilutov)
. Fix may_have_extra_named_args flag for ZEND_AST_UNPACK. (nielsdos)
. Fix NULL arithmetic in System V shared memory emulation for Windows. (cmb)
- DOM:
. Fixed bug GH-17397 (Assertion failure ext/dom/php_dom.c). (nielsdos)

View file

@ -402,19 +402,21 @@ static shm_pair *shm_get(key_t key, void *addr)
shm_pair *ptr;
shm_pair *newptr;
for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
if (!ptr->descriptor) {
continue;
if (TWG(shm) != NULL) {
for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
if (!ptr->descriptor) {
continue;
}
if (!addr && ptr->descriptor->shm_perm.key == key) {
break;
} else if (ptr->addr == addr) {
break;
}
}
if (!addr && ptr->descriptor->shm_perm.key == key) {
break;
} else if (ptr->addr == addr) {
break;
}
}
if (ptr < (TWG(shm) + TWG(shm_size))) {
return ptr;
if (ptr < (TWG(shm) + TWG(shm_size))) {
return ptr;
}
}
newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair));