summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-11-18 13:07:37 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-11-18 13:07:37 +0400
commit807934d08345c69ae31e0a0a1fcf7c92431d6204 (patch)
tree9bc2c3b0faf2a7202fd095eb5d3355ae0774b0ad
parent4d882329a998b7955cf164b5ff687e623d25bbb5 (diff)
downloadmariadb-git-807934d08345c69ae31e0a0a1fcf7c92431d6204.tar.gz
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.
-rw-r--r--strings/ctype-bin.c2
-rw-r--r--strings/ctype-mb.c4
-rw-r--r--strings/ctype-simple.c15
3 files changed, 16 insertions, 5 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 3ca4ba2b430..2e699db0bd3 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -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);
}
}
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index b0413099ca8..02a9a91ca6a 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -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);
}
}
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 0785ba35700..7f13cef4474 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -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);
}
}