Skip to content

ext/sysvshm: do not trust $size when opening an existing segment - #22982

Open
devnexen wants to merge 1 commit into
php:PHP-8.4from
devnexen:shm_size_bug_fix
Open

ext/sysvshm: do not trust $size when opening an existing segment#22982
devnexen wants to merge 1 commit into
php:PHP-8.4from
devnexen:shm_size_bug_fix

Conversation

@devnexen

Copy link
Copy Markdown
Member

shm_attach() wrote the requested size into the header of a segment it did not create, so a foreign segment framed as larger than it is let shm_put_var() write past the mapping. Take the size from shmctl() IPC_STAT instead, and reject a segment too small to hold the header.

Noticed while reviewing GH-22959.

shm_attach() wrote the requested size into the header of a segment it
did not create, so a foreign segment framed as larger than it is let
shm_put_var() write past the mapping. Take the size from shmctl()
IPC_STAT instead, and reject a segment too small to hold the header.

Noticed while reviewing phpGH-22959.
@devnexen
devnexen marked this pull request as ready for review August 1, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant