List:Commits« Previous MessageNext Message »
From:bar Date:March 20 2006 11:57am
Subject:bk commit into 5.1 tree (bar:1.2190) BUG#18172
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2190 06/03/20 14:57:34 bar@stripped +3 -0
    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.

  mysql-test/r/xml.result
    1.10 06/03/20 14:53:12 bar@stripped +3 -1
    Adding test case.
    Also, this change makes error message
    to be generated earlier in the case of another
    bad XPATH syntax.

  mysql-test/t/xml.test
    1.10 06/03/20 14:53:06 bar@stripped +9 -0
    Adding test case.

  sql/item_xmlfunc.cc
    1.10 06/03/20 14:51:01 bar@stripped +4 -1
    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.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	bar
# Host:	bar.intranet.mysql.r18.ru
# Root:	/usr/home/bar/mysql-5.1-new.b18172

--- 1.9/mysql-test/r/xml.result	2006-03-15 11:57:07 +04:00
+++ 1.10/mysql-test/r/xml.result	2006-03-20 14:53:12 +04:00
@@ -546,7 +546,7 @@
 extractvalue('<a>a<b>B</b></a>','a|/b')
 a
 select extractvalue('<a>A</a>','/<a>');
-ERROR HY000: XPATH syntax error: '>'
+ERROR HY000: XPATH syntax error: '<a>'
 select
extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
 ERROR HY000: XPATH syntax error: '!'
 select
extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*');
@@ -612,4 +612,6 @@
 select extractValue('<e>1</e>','position()');
 ERROR HY000: XPATH syntax error: ''
 select extractValue('<e>1</e>','last()');
+ERROR HY000: XPATH syntax error: ''
+select extractValue('<e><a>1</a></e>','/e/');
 ERROR HY000: XPATH syntax error: ''

--- 1.9/mysql-test/t/xml.test	2006-03-15 11:57:02 +04:00
+++ 1.10/mysql-test/t/xml.test	2006-03-20 14:53:06 +04:00
@@ -286,3 +286,12 @@
 select extractValue('<e>1</e>','position()');
 --error 1105
 select extractValue('<e>1</e>','last()');
+
+
+#
+# Bug #18172 XML: Extractvalue() accepts mallformed
+# XPath without a XPath syntax error
+#
+--error 1105
+select extractValue('<e><a>1</a></e>','/e/');
+

--- 1.9/sql/item_xmlfunc.cc	2006-03-15 11:56:26 +04:00
+++ 1.10/sql/item_xmlfunc.cc	2006-03-20 14:51:01 +04:00
@@ -1561,10 +1561,13 @@
     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;
 }
 
 
Thread
bk commit into 5.1 tree (bar:1.2190) BUG#18172bar20 Mar