From 01b68c51052514681287dd63e8e713742c42cd0c Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 3 May 2011 10:48:24 +0300 Subject: Bug #12375190: UPDATEXML CRASHES ON SIMPLE INPUTS The XPATH implementation was not handling correctly the XPATH production #19 (http://www.w3.org/TR/1999/REC-xpath-19991116/#node-sets), namely PathExpr ::= | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath It was lacking context for the RelativeLocationPath and it was just ignoring the second slash instead of treating it as a different axis specifier. Fixed the above two problems and added a test case. --- mysql-test/r/xml.result | 18 ++++++++++++++++++ mysql-test/t/xml.test | 9 +++++++++ 2 files changed, 27 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 8ca9ab84bf7..30aa77ddf37 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1144,5 +1144,23 @@ SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0); UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0) NULL # +# Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS +# +SELECT UPDATEXML('','(a)/a',''); +UPDATEXML('','(a)/a','') + +SELECT UPDATEXML('x','(a)/a',''); +UPDATEXML('x','(a)/a','') + +SELECT UPDATEXML('x','(a)/a',''); +UPDATEXML('x','(a)/a','') +x +SELECT UPDATEXML('x','(a)//a',''); +UPDATEXML('x','(a)//a','') + +SELECT ExtractValue('aabb','(a)/a|(a)/b'); +ExtractValue('aabb','(a)/a|(a)/b') +aa bb +# # End of 5.5 tests # diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 89c0b8992b1..b36bd2067cc 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -664,6 +664,15 @@ SELECT ExtractValue(CONVERT('<\"', BINARY(10)), 1); SET NAMES latin1; SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0); +--echo # +--echo # Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS +--echo # +SELECT UPDATEXML('','(a)/a',''); +SELECT UPDATEXML('x','(a)/a',''); +SELECT UPDATEXML('x','(a)/a',''); +SELECT UPDATEXML('x','(a)//a',''); +SELECT ExtractValue('aabb','(a)/a|(a)/b'); + --echo # --echo # End of 5.5 tests --echo # -- cgit v1.2.1