From 1d09ec6208010830e20970531fcb8d7ff6f733d8 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 4 Feb 2009 15:40:12 +0400 Subject: Bug#42495 updatexml: Assertion failed: xpath->context, file .\item_xmlfunc.cc, line 2507 Problem: RelativeLocationPath can appear only after a node-set expression in the third and the fourth branches of this rule: PathExpr :: = LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath XPatch code didn't check the type of FilterExpr and crashed. Fix: If FilterExpr is a scalar expression (variable reference, literal, number, scalar function call) return error. mysql-test/r/xml.result: test result mysql-test/t/xml.test: test case sql/item_xmlfunc.cc: Problem: RelativeLocationPath can appear only after a node-set expression in the third and the fourth branches of this rule: PathExpr :: = LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath XPatch code didn't check the type of FilterExpr and crashed. Fix: If FilterExpr is a scalar expression (variable reference, literal, number, scalar function call) return error. --- mysql-test/t/xml.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mysql-test/t/xml.test') diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index d840e14ba5f..74bce8dc962 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -575,5 +575,19 @@ SELECT ExtractValue(@xml, 'html/body'); SELECT ExtractValue('CharData', '/xml'); SELECT ExtractValue('CharData', '/xml'); +# +# Bug#42495 updatexml: Assertion failed: xpath->context, file .\item_xmlfunc.cc, line 2507 +# +set @x=10; +--error ER_UNKNOWN_ERROR +select extractvalue('','$@x/a'); +--error ER_UNKNOWN_ERROR +select extractvalue('','round(123.4)/a'); +--error ER_UNKNOWN_ERROR +select extractvalue('','1/a'); +--error ER_UNKNOWN_ERROR +select extractvalue('','"b"/a'); +--error ER_UNKNOWN_ERROR +select extractvalue('','(1)/a'); --echo End of 5.1 tests -- cgit v1.2.1