Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-5689

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.12, 5.5.33a, 10.0.6
    • Fix Version/s: 10.0.10
    • Component/s: None
    • Labels:
      None

      Description

      This query crashes the server:

      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:

      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)
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              serg Sergei Golubchik added a comment -

              5.5 crash is already fixed, so this patch is considered for 10.0 only

              Show
              serg Sergei Golubchik added a comment - 5.5 crash is already fixed, so this patch is considered for 10.0 only
              Hide
              bar Alexander Barkov added a comment -

              Pushed into 10.0

              Show
              bar Alexander Barkov added a comment - Pushed into 10.0

                People

                • Assignee:
                  bar Alexander Barkov
                  Reporter:
                  bar Alexander Barkov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: