From: Lauri Kenttä Date: Sat, 21 May 2016 15:46:00 +0000 (+0300) Subject: Fix bug #72221 (segfault, past-the-end access) X-Git-Tag: php-7.1.0alpha1~79^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26fa27d760c7b119805ba6d9db624f479d9b9fc8;p=php Fix bug #72221 (segfault, past-the-end access) --- diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index f47a148564..8eb9a7b637 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2965,6 +2965,9 @@ ZEND_API const char* ZEND_FASTCALL zend_memnstr_ex(const char *haystack, const c if (i == needle_len) { return p; } + if (UNEXPECTED(p == end)) { + return NULL; + } p += td[(unsigned char)(p[needle_len])]; }