mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -1053,4 +1053,15 @@ ExtractValue('<xml xxx "yyy">CharData</xml>', '/xml')
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 17: STRING unexpected ('>' wanted)'
|
||||
set @x=10;
|
||||
select extractvalue('<a></a>','$@x/a');
|
||||
ERROR HY000: XPATH syntax error: '/a'
|
||||
select extractvalue('<a></a>','round(123.4)/a');
|
||||
ERROR HY000: XPATH syntax error: '/a'
|
||||
select extractvalue('<a></a>','1/a');
|
||||
ERROR HY000: XPATH syntax error: '/a'
|
||||
select extractvalue('<a></a>','"b"/a');
|
||||
ERROR HY000: XPATH syntax error: '/a'
|
||||
select extractvalue('<a></a>','(1)/a');
|
||||
ERROR HY000: XPATH syntax error: '/a'
|
||||
End of 5.1 tests
|
||||
|
@ -575,5 +575,19 @@ SELECT ExtractValue(@xml, 'html/body');
|
||||
SELECT ExtractValue('<xml "xxx" "yyy">CharData</xml>', '/xml');
|
||||
SELECT ExtractValue('<xml xxx "yyy">CharData</xml>', '/xml');
|
||||
|
||||
#
|
||||
# Bug#42495 updatexml: Assertion failed: xpath->context, file .\item_xmlfunc.cc, line 2507
|
||||
#
|
||||
set @x=10;
|
||||
--error ER_UNKNOWN_ERROR
|
||||
select extractvalue('<a></a>','$@x/a');
|
||||
--error ER_UNKNOWN_ERROR
|
||||
select extractvalue('<a></a>','round(123.4)/a');
|
||||
--error ER_UNKNOWN_ERROR
|
||||
select extractvalue('<a></a>','1/a');
|
||||
--error ER_UNKNOWN_ERROR
|
||||
select extractvalue('<a></a>','"b"/a');
|
||||
--error ER_UNKNOWN_ERROR
|
||||
select extractvalue('<a></a>','(1)/a');
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user