From: Date: October 8 2007 1:52pm Subject: bk commit into 5.1 tree (ramil:1.2582) BUG#31438 List-Archive: http://lists.mysql.com/commits/35094 X-Bug: 31438 Message-Id: <20071008115219.CCD393400077@ramil.myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 5.1 repository of ram. When ram 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@stripped, 2007-10-08 16:52:15+05:00, ramil@stripped +3 -0 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@stripped, 2007-10-08 16:52:13+05:00, ramil@stripped +11 -0 Fix for bug #31438: updatexml still crashes - test result. mysql-test/t/xml.test@stripped, 2007-10-08 16:52:13+05:00, ramil@stripped +11 -0 Fix for bug #31438: updatexml still crashes - test case. sql/item_xmlfunc.cc@stripped, 2007-10-08 16:52:13+05:00, ramil@stripped +2 -1 Fix for bug #31438: updatexml still crashes - check if the second argument passed to the updatexml() is valid. diff -Nrup a/mysql-test/r/xml.result b/mysql-test/r/xml.result --- a/mysql-test/r/xml.result 2007-09-14 18:38:25 +05:00 +++ b/mysql-test/r/xml.result 2007-10-08 16:52:13 +05:00 @@ -1012,3 +1012,14 @@ select ExtractValue('a', '/a[@x=@ ERROR HY000: XPATH error: comparison of two nodesets is not supported: '=@y0123456789_0123456789_0123456' select ExtractValue('a', '/a[@x=$y0123456789_0123456789_0123456789_0123456789]'); 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 diff -Nrup a/mysql-test/t/xml.test b/mysql-test/t/xml.test --- a/mysql-test/t/xml.test 2007-05-23 12:34:44 +05:00 +++ b/mysql-test/t/xml.test 2007-10-08 16:52:13 +05:00 @@ -533,3 +533,14 @@ select UpdateXML('a',repeat('a b select ExtractValue('a', '/a[@x=@y0123456789_0123456789_0123456789_0123456789]'); --error 1105 select ExtractValue('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 diff -Nrup a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc --- a/sql/item_xmlfunc.cc 2007-08-13 18:11:11 +05:00 +++ b/sql/item_xmlfunc.cc 2007-10-08 16:52:13 +05:00 @@ -2580,7 +2580,8 @@ void Item_xml_str_func::fix_length_and_d return; } - xp= args[1]->val_str(&tmp); + if (!(xp= args[1]->val_str(&tmp))) + return; my_xpath_init(&xpath); xpath.cs= collation.collation; xpath.debug= 0;