summaryrefslogtreecommitdiff
path: root/sql/item_xmlfunc.cc
diff options
context:
space:
mode:
authorAnirudh Mangipudi <anirudh.mangipudi@oracle.com>2013-11-25 13:50:19 +0530
committerAnirudh Mangipudi <anirudh.mangipudi@oracle.com>2013-11-25 13:50:19 +0530
commitb32f13ee4731db93bfacd99730ed7b8ef944eccd (patch)
tree006ef205af6a72607d90ae1a0563978ef0edcd59 /sql/item_xmlfunc.cc
parent16db26fcf1f8297f8a4e8b5d8d8d081d4037c5ae (diff)
parent0f89c3667b1ea7c0847278c0b54f26539824d51c (diff)
downloadmariadb-git-b32f13ee4731db93bfacd99730ed7b8ef944eccd.tar.gz
Bug#12428404 MYSQLD.EXE CRASHES WHEN EXTRACTVALUE() IS CALLED WITH
MALFORMED XPATH EXP Problem: A malformed XPATH expression in the ExtractValue query is causing a server crash. This malformed XPATH expression is resulted when the position attribute in the substring function contains ".." in the beginning. Solution: The original crash is happening because the "../" is being evaluated prematurely. It tries to access XML while it hasn't been parsed yet. The premature evaluation is happening because the val_nodeset function is being set to constant, in which case we proceed to evaluate them in JOIN:prepare stage only. The solution to this is setting the val_nodeset functions as non-constant. This forces us to evaluate the function in the JOIN:exec stage and thus avoid any premature evaluation of the XML strings.
Diffstat (limited to 'sql/item_xmlfunc.cc')
-rw-r--r--sql/item_xmlfunc.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index c6902878c86..0a4f501186e 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -226,6 +226,9 @@ public:
{
max_length= MAX_BLOB_WIDTH;
collation.collation= pxml->charset();
+ // To avoid premature evaluation, mark all nodeset functions as non-const.
+ used_tables_cache= RAND_TABLE_BIT;
+ const_item_cache= false;
}
const char *func_name() const { return "nodeset"; }
};