[php-src] PR #25729: Resolve negative preg_match() offsets outside php_pcre_match_impl()

From: Date: Wed, 25 Nov 2026 06:49:41 +0000
Subject: [php-src] PR #25729: Resolve negative preg_match() offsets outside php_pcre_match_impl()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40986@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25729 Author: marc-mabe php_pcre_match_impl() took the start offset as zend_off_t, a type meant for file offsets, and resolved negative offsets itself by negating them, which overflows for ZEND_LONG_MIN. To avoid that, preg_match() and preg_match_all() rejected PHP_INT_MIN with a ValueError (#16189). Resolve negative offsets in preg_match() and preg_match_all() instead, where PHP_INT_MIN now starts at the beginning of the subject like any other negative offset beyond its length, and make php_pcre_match_impl() take a size_t offset. Callers with a constant offset of 0, such as the frameless preg_match() call and RegexIterator, no longer pay for the negative offset handling.

« previous php.git-pulls (#40986) next »