Commit c0cc6d2a authored by unknown's avatar unknown

Fix for bug #31438: updatexml still crashes

Problem: check missed if the second updatexml() argument is valid.

Fix: check it.


mysql-test/r/xml.result:
  Fix for bug #31438: updatexml still crashes
    - test result.
mysql-test/t/xml.test:
  Fix for bug #31438: updatexml still crashes
    - test case.
sql/item_xmlfunc.cc:
  Fix for bug #31438: updatexml still crashes
    - check if the second argument passed to the updatexml() is valid.
parent 6b957bcb
...@@ -1012,3 +1012,14 @@ select ExtractValue('<a>a</a>', '/a[@x=@y0123456789_0123456789_0123456789_012345 ...@@ -1012,3 +1012,14 @@ select ExtractValue('<a>a</a>', '/a[@x=@y0123456789_0123456789_0123456789_012345
ERROR HY000: XPATH error: comparison of two nodesets is not supported: '=@y0123456789_0123456789_0123456' ERROR HY000: XPATH error: comparison of two nodesets is not supported: '=@y0123456789_0123456789_0123456'
select ExtractValue('<a>a</a>', '/a[@x=$y0123456789_0123456789_0123456789_0123456789]'); select ExtractValue('<a>a</a>', '/a[@x=$y0123456789_0123456789_0123456789_0123456789]');
ERROR HY000: Unknown XPATH variable at: '$y0123456789_0123456789_01234567' ERROR HY000: Unknown XPATH variable at: '$y0123456789_0123456789_01234567'
select updatexml(NULL, 1, 1), updatexml(1, NULL, 1), updatexml(1, 1, NULL);
updatexml(NULL, 1, 1) updatexml(1, NULL, 1) updatexml(1, 1, NULL)
NULL NULL NULL
select updatexml(NULL, NULL, 1), updatexml(1, NULL, NULL),
updatexml(NULL, 1, NULL);
updatexml(NULL, NULL, 1) updatexml(1, NULL, NULL) updatexml(NULL, 1, NULL)
NULL NULL NULL
select updatexml(NULL, NULL, NULL);
updatexml(NULL, NULL, NULL)
NULL
End of 5.1 tests
...@@ -533,3 +533,14 @@ select UpdateXML('<a>a</a>',repeat('a b ',1000),''); ...@@ -533,3 +533,14 @@ select UpdateXML('<a>a</a>',repeat('a b ',1000),'');
select ExtractValue('<a>a</a>', '/a[@x=@y0123456789_0123456789_0123456789_0123456789]'); select ExtractValue('<a>a</a>', '/a[@x=@y0123456789_0123456789_0123456789_0123456789]');
--error 1105 --error 1105
select ExtractValue('<a>a</a>', '/a[@x=$y0123456789_0123456789_0123456789_0123456789]'); select ExtractValue('<a>a</a>', '/a[@x=$y0123456789_0123456789_0123456789_0123456789]');
#
# Bug #31438: updatexml still crashes
#
select updatexml(NULL, 1, 1), updatexml(1, NULL, 1), updatexml(1, 1, NULL);
select updatexml(NULL, NULL, 1), updatexml(1, NULL, NULL),
updatexml(NULL, 1, NULL);
select updatexml(NULL, NULL, NULL);
--echo End of 5.1 tests
...@@ -2580,7 +2580,8 @@ void Item_xml_str_func::fix_length_and_dec() ...@@ -2580,7 +2580,8 @@ void Item_xml_str_func::fix_length_and_dec()
return; return;
} }
xp= args[1]->val_str(&tmp); if (!(xp= args[1]->val_str(&tmp)))
return;
my_xpath_init(&xpath); my_xpath_init(&xpath);
xpath.cs= collation.collation; xpath.cs= collation.collation;
xpath.debug= 0; xpath.debug= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment