You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
shmop_open should throw ValueError for ids overflowing sizeof int #9945
Yeah, that behavior is not correct; however, key_t is underspecified by POSIX; it merely mandates that key_t is an arithmetic type, so we probably can't assume it is int everywhere.
Yeah, that behavior is not correct; however, key_t is underspecified by POSIX; it merely mandates that key_t is an arithmetic type, so we probably can't assume it is int everywhere.
key != (zend_long)(key_t)key should work as a runtime check.
it merely mandates that key_t is an arithmetic type
This is ugly, since arithmetic types even include float etc. However, we can hopefully assume that it is actually an integer type, and as such could determine the details during configuration: its size (sizeof(key_t), and its signedness.
Activity
cmb69 commentedon Nov 14, 2022
Yeah, that behavior is not correct; however,
key_tis underspecified by POSIX; it merely mandates thatkey_tis an arithmetic type, so we probably can't assume it isinteverywhere.TysonAndre commentedon Nov 14, 2022
key != (zend_long)(key_t)keyshould work as a runtime check.cmb69 commentedon Nov 15, 2022
If
key_tis signed and its rank is less than that ofzend_long, wouldn't that possibly be undefined behavior.Anyhow,
shm_attach()has exactly the same issue thanshmop_open().cmb69 commentedon Nov 15, 2022
This is ugly, since arithmetic types even include
floatetc. However, we can hopefully assume that it is actually an integer type, and as such could determine the details during configuration: its size (sizeof(key_t), and its signedness.Fix phpGH-9945: Reject shmop/sysvshm keys outside key_t range
Fix GH-9945: Reject shmop/sysvshm keys outside key_t range (#22423)
ext/sysvmsg: fix IPC_PRIVATE and out-of-range key handling
sysvmsg/sysvsem: fix IPC_PRIVATE and out-of-range key handling
sysvmsg/sysvsem: fix IPC_PRIVATE and out-of-range key handling (#22956)