Commit 807934d0 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-7086 main.ctype_cp932 fails in buildbot on a valgrind build

Removing a redundant and wrong condition which could access beyond
the pattern string range.
parent 4d882329
......@@ -395,7 +395,7 @@ int my_wildcmp_bin_impl(CHARSET_INFO *cs,
if (tmp <= 0)
return(tmp);
}
} while (str != str_end && wildstr[0] != w_many);
} while (str != str_end);
return(-1);
}
}
......
......@@ -354,7 +354,7 @@ int my_wildcmp_mb_impl(CHARSET_INFO *cs,
if (tmp <= 0)
return (tmp);
}
} while (str != str_end && wildstr[0] != w_many);
} while (str != str_end);
return(-1);
}
}
......@@ -1192,7 +1192,7 @@ static int my_wildcmp_mb_bin_impl(CHARSET_INFO *cs,
if (tmp <= 0)
return (tmp);
}
} while (str != str_end && wildstr[0] != w_many);
} while (str != str_end);
return(-1);
}
}
......
......@@ -936,9 +936,14 @@ int my_wildcmp_8bit_impl(CHARSET_INFO *cs,
cmp=likeconv(cs,cmp);
do
{
/*
Find the next character in the subject string equal to 'cmp', then
check recursively my_wildcmp_8bit_impl() for the pattern remainder.
*/
while (str != str_end && (uchar) likeconv(cs,*str) != cmp)
str++;
if (str++ == str_end) return(-1);
if (str++ == str_end)
return(-1); /* 'cmp' was not found in the subject string */
{
int tmp=my_wildcmp_8bit_impl(cs,str,str_end,
wildstr,wildend,escape,w_one,
......@@ -946,7 +951,13 @@ int my_wildcmp_8bit_impl(CHARSET_INFO *cs,
if (tmp <= 0)
return(tmp);
}
} while (str != str_end && wildstr[0] != w_many);
/*
The recursion call did not match. But it returned 1, which means
the pattern remainder has some non-special characters.
Continue, there is a chance that we'll find another 'cmp'
at a different position in the subject string.
*/
} while (str != str_end);
return(-1);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment