• Joerg Bruehe's avatar
    This is a backport from 5.1.32 into 5.1.31sp1. · 5d4d200b
    Joerg Bruehe authored
    The original fix was done by Sergey Glukhov on 2009-02-04
    All comments are copied from the original fix:
    
    
    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  ((for bug#42495))
    mysql-test/t/xml.test:
      test case  ((for bug#42495))
    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.
    5d4d200b
item_xmlfunc.cc 71.8 KB