We're updating the issue view to help you get more done. 

ExtractValue(xml, 'substring(/x,/y)') crashes

Description

This query crashes the server:

1 SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,..)');

Notice '..' in the 'position' argument to XPath substring() function,
which obviously goes above the root XML element.

If I change the position argument to something inside the XML tree,
it works fine:

1 2 3 4 5 6 7 mysql> SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,/a/c)'); +--------------------------------------------------------------------------+ | ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,/a/c)') | +--------------------------------------------------------------------------+ | bc | +--------------------------------------------------------------------------+ 1 row in set (0.00 sec)

Environment

None

Status

Assignee

Alexander Barkov

Reporter

Alexander Barkov

Labels

None

External issue ID

None

External issue ID

None

Fix versions

Affects versions

5.3.12
10.0.6
5.5.33a

Priority

Major