summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2006-03-15 11:57:37 +0400
committerunknown <bar@mysql.com>2006-03-15 11:57:37 +0400
commit1dc87feb20fbfd7cf3fe974f7e39fd6892ebcf85 (patch)
tree31850c00ce0901fc06bfbb88199ee196d6ce4d9b /sql
parent4ac5afa3b991654a38b39ad44880e74da06a02c3 (diff)
downloadmariadb-git-1dc87feb20fbfd7cf3fe974f7e39fd6892ebcf85.tar.gz
xml.result, xml.test:
Adding test. item_xmlfunc.cc: Bug #18171 XML: ExtractValue: the XPath position() function crashes the server! Disallowing use of position() and last() without context. sql/item_xmlfunc.cc: Bug #18171 XML: ExtractValue: the XPath position() function crashes the server! Disallowing use of position() and last() without context. mysql-test/t/xml.test: Adding test. mysql-test/r/xml.result: Adding test.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_xmlfunc.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 7378be0ac4c..da39c1e4409 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -1141,13 +1141,15 @@ static Item *create_func_round(MY_XPATH *xpath, Item **args, uint nargs)
static Item *create_func_last(MY_XPATH *xpath, Item **args, uint nargs)
{
- return new Item_func_xpath_count(xpath->context, xpath->pxml);
+ return xpath->context ?
+ new Item_func_xpath_count(xpath->context, xpath->pxml) : NULL;
}
static Item *create_func_position(MY_XPATH *xpath, Item **args, uint nargs)
{
- return new Item_func_xpath_position(xpath->context, xpath->pxml);
+ return xpath->context ?
+ new Item_func_xpath_position(xpath->context, xpath->pxml) : NULL;
}