[php-src] PR #22429: Fix OOB read in opcache POSIX largepage page-size selection
| From: | iliaal | Date: | Wed, 24 Jun 2026 11:22:19 +0000 |
| Subject: | [php-src] PR #22429: Fix OOB read in opcache POSIX largepage page-size selection | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36595@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22429
Author: iliaal
create_segments() under HAVE_SHM_CREATE_LARGEPAGE stored the int return of getpagesizes() in a
size_t and iterated with a size_t counter. On the getpagesizes() error return (-1) the size_t became
SIZE_MAX, passing the > 0 guard, and the unsigned counter made i >= 0 always true, so the loop
ran from a huge index and read far outside the 3-element shared_segment_sindexes array; even on
success, if no returned page size divided requested_size the counter wrapped past 0. Capture the
result in a signed int and iterate signed. This path is FreeBSD-only (HAVE_SHM_CREATE_LARGEPAGE), so
it is not compiled or exercised on the Linux CI; the change is a type/sign correction within that
block.