diff options
author | unknown <bar@mysql.com> | 2006-03-20 14:57:34 +0400 |
---|---|---|
committer | unknown <bar@mysql.com> | 2006-03-20 14:57:34 +0400 |
commit | 5f8bd7fe0f4ecc534b24f1e13276b7200ec14bd2 (patch) | |
tree | f209b3c5a6738ea9d5c2ec741c26d967825e724c /sql/item_xmlfunc.cc | |
parent | f9dd31ca8ec96c2c315a9f8011d4f1ed5b73b0a4 (diff) | |
download | mariadb-git-5f8bd7fe0f4ecc534b24f1e13276b7200ec14bd2.tar.gz |
Bug #18172 XML: Extractvalue() accepts mallformed
XPath without a XPath syntax error
item_xmlfunc.cc:
Error message didn't happen because after
a failing attempt to parse RelativeLocationPath,
my_xpath_parse_AbsoluteLocationPath() returned success.
Changeing logic a bit:
- Try to parse EOF first, return success if true.
- Then try to parse RelativeLocationPath(), return success if true.
- Otherwise return failure.
xml.result:
Adding test case.
Also, this change made it possible to generate
an error message earlier in the case of another
bad XPATH syntax.
xml.test:
Adding test case.
sql/item_xmlfunc.cc:
Bug #18172 XML: Extractvalue() accepts mallformed XPath without a XPath syntax error
Error message didn't happen because after
a failing attempt to parse RelativeLocationPath(),
my_xpath_parse_AbsoluteLocationPath() returned with 1.
Changeing logic a bit: check for EOF first.
Then try to parse RelativeLocationPath().
If the latter fails, return failure.
mysql-test/t/xml.test:
Adding test case.
mysql-test/r/xml.result:
Adding test case.
Also, this change makes error message
to be generated earlier in the case of another
bad XPATH syntax.
Diffstat (limited to 'sql/item_xmlfunc.cc')
-rw-r--r-- | sql/item_xmlfunc.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index da39c1e4409..8e5efa9f0f5 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -1561,10 +1561,13 @@ static int my_xpath_parse_AbsoluteLocationPath(MY_XPATH *xpath) return my_xpath_parse_RelativeLocationPath(xpath); } + if (my_xpath_parse_term(xpath, MY_XPATH_LEX_EOF)) + return 1; + if (my_xpath_parse_RelativeLocationPath(xpath)) return 1; - return 1; + return 0; } |