]> granicus.if.org Git - php/commitdiff
Fix bug #72221 (segfault, past-the-end access)
authorLauri Kenttä <lauri.kentta@gmail.com>
Sat, 21 May 2016 15:46:00 +0000 (18:46 +0300)
committerXinchen Hui <laruence@gmail.com>
Sat, 28 May 2016 08:10:16 +0000 (16:10 +0800)
Zend/zend_operators.c

index 50557e56d80dbd97fd46f2e347e157f266e85498..a02551b1bdd5f7f86769675a4073a30bcdfff2e7 100644 (file)
@@ -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])];
        }