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

UPDATEXML crashes the server on deeply nested unary XPath expression

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Duplicate
    • 12.3.3
    • N/A
    • XML Functions
    • None
    • Linux/amd64; MariaDB 12.3.3-MariaDB-ubu2404
    • Not for Release Notes

    Description

      UPDATEXML crashes the MariaDB server when it parses an XPath expression containing 100,000 consecutive unary minus operators. This occurs when UPDATEXML parses an XPath expression containing 100,000 consecutive unary minus operators.

      Reproducer

      Execute this statement on a healthy server:

      SELECT UPDATEXML(NULL, REPEAT('-', 100000), 'x') AS xpath_result;

      The statement creates no database objects and requires no cleanup.

      Decisive observation

      The recorded execution produced no SQL output and terminated the client with exit code 137. Immediately afterward, the previously healthy mariadbd process was no longer running. Runtime diagnostics reported:

      Running: false
      OOMKilled: false
      ExitCode: 139

      A second recorded execution also interrupted the server and required automatic recovery.

      Semantic mismatch

      The server should reject the deeply nested XPath with a controlled SQL error and remain available. Instead, parsing the expression terminates the server process.

      The grammar production UnaryExpr ::= '-' UnaryExpr directly recurses for every minus operator. The behavior is consistent with that recursion exhausting the thread stack without stack-boundary enforcement, although no stack trace was retained to confirm the internal mechanism.

      Attachments

        Activity

          People

            Unassigned Unassigned
            noob liu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.