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.2101 06/02/10 13:24:10 bar@stripped +3 -0
Bug#16234 XML: Crash if ExtractValue()
Also fixes 16314: XML: extractvalue() crash if vertical bar
xml.result, xml.test:
Adding test case
item_xmlfunc.cc:
Using root element as a context node,
instead of NULL, with relative paths.
mysql-test/r/xml.result
1.2 06/02/10 13:22:52 bar@stripped +22 -0
Adding test case
mysql-test/t/xml.test
1.2 06/02/10 13:22:41 bar@stripped +16 -0
Adding test case
sql/item_xmlfunc.cc
1.3 06/02/10 13:20:43 bar@stripped +6 -1
Bug#16234 XML: Crash if ExtractValue()
Also fixes 16314: XML: extractvalue() crash if vertical bar
Use root element as a context node,
instead of NULL, with relative paths.
# 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.16234
--- 1.1/mysql-test/r/xml.result 2005-12-21 17:04:30 +04:00
+++ 1.2/mysql-test/r/xml.result 2006-02-10 13:22:52 +04:00
@@ -520,3 +520,25 @@
select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"');
UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"')
<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb3="bb3">bb</b></a>
+SET @xml= '<order><clerk>lesser wombat</clerk></order>';
+select extractvalue(@xml,'order/clerk');
+extractvalue(@xml,'order/clerk')
+lesser wombat
+select extractvalue(@xml,'/order/clerk');
+extractvalue(@xml,'/order/clerk')
+lesser wombat
+select extractvalue('<a><b>B</b></a>','/a|/b');
+extractvalue('<a><b>B</b></a>','/a|/b')
+
+select extractvalue('<a><b>B</b></a>','/a|b');
+extractvalue('<a><b>B</b></a>','/a|b')
+
+select extractvalue('<a>a<b>B</b></a>','/a|/b');
+extractvalue('<a>a<b>B</b></a>','/a|/b')
+a
+select extractvalue('<a>a<b>B</b></a>','/a|b');
+extractvalue('<a>a<b>B</b></a>','/a|b')
+a
+select extractvalue('<a>a<b>B</b></a>','a|/b');
+extractvalue('<a>a<b>B</b></a>','a|/b')
+a
--- 1.1/mysql-test/t/xml.test 2005-12-21 17:04:38 +04:00
+++ 1.2/mysql-test/t/xml.test 2006-02-10 13:22:41 +04:00
@@ -215,3 +215,19 @@
select UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"');
select UpdateXML(@xml, '/a/b/@bb2', '');
select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"');
+
+#
+# Bug#16234 XML: Crash if ExtractValue()
+#
+SET @xml= '<order><clerk>lesser wombat</clerk></order>';
+select extractvalue(@xml,'order/clerk');
+select extractvalue(@xml,'/order/clerk');
+
+#
+# Bug#16314 XML: extractvalue() crash if vertical bar
+#
+select extractvalue('<a><b>B</b></a>','/a|/b');
+select extractvalue('<a><b>B</b></a>','/a|b');
+select extractvalue('<a>a<b>B</b></a>','/a|/b');
+select extractvalue('<a>a<b>B</b></a>','/a|b');
+select extractvalue('<a>a<b>B</b></a>','a|/b');
--- 1.2/sql/item_xmlfunc.cc 2006-01-05 12:18:20 +04:00
+++ 1.3/sql/item_xmlfunc.cc 2006-02-10 13:20:43 +04:00
@@ -101,6 +101,7 @@
MY_XPATH_FUNC *func; /* last scanned function creator */
Item *item; /* current expression */
Item *context; /* last scanned context */
+ Item *rootelement; /* The root element */
String *context_cache; /* last context provider */
String *pxml; /* Parsed XML, an array of MY_XML_NODE */
CHARSET_INFO *cs; /* character set/collation string comparison */
@@ -1464,6 +1465,8 @@
{
Item *context= xpath->context;
+ if (!xpath->context)
+ xpath->context= xpath->rootelement;
int rc= my_xpath_parse_RelativeLocationPath(xpath) ||
my_xpath_parse_AbsoluteLocationPath(xpath);
@@ -1496,7 +1499,7 @@
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
return 0;
- xpath->context= new Item_nodeset_func_rootelement(xpath->pxml);
+ xpath->context= xpath->rootelement;
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
{
@@ -2291,6 +2294,8 @@
my_xpath_lex_init(&xpath->query, str, strend);
my_xpath_lex_init(&xpath->prevtok, str, strend);
my_xpath_lex_scan(xpath, &xpath->lasttok, str, strend);
+
+ xpath->rootelement= new Item_nodeset_func_rootelement(xpath->pxml);
return
my_xpath_parse_Expr(xpath) &&
| Thread |
|---|
| • bk commit into 5.1 tree (bar:1.2101) BUG#16234 | bar | 10 Feb |