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.0.8RC1~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=287f9489d840f0e2c192c8db9fe69f7b03bb8af5;p=php Fix bug #72221 (segfault, past-the-end access) --- diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 50557e56d8..a02551b1bd 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2927,6 +2927,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])]; }