Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/zend_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -939,15 +939,15 @@ zend_memnistr(const char *haystack, const char *needle, size_t needle_len, const
return haystack;
}

if (UNEXPECTED(needle_len > (end - haystack))) {
if (UNEXPECTED(needle_len > (size_t)(end - haystack))) {
return NULL;
}

const char first_lower = zend_tolower_ascii(*needle);
const char first_upper = zend_toupper_ascii(*needle);
const char *p_lower = (const char *)memchr(haystack, first_lower, end - haystack);
const char *p_upper = NULL;
if (first_lower != first_upper) {
if (first_lower != first_upper) {
// If the needle length is 1 we don't need to look beyond p_lower as it is a guaranteed match
size_t upper_search_length = end - (needle_len == 1 && p_lower != NULL ? p_lower : haystack);
p_upper = (const char *)memchr(haystack, first_upper, upper_search_length);
Expand Down