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

Assertion `0' failed in Protocol::end_statement() on SELECT TO_NUMBER(NULL, NULL)

    XMLWordPrintable

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 12.3, 13.2
    • 12.3
    • Server

    Description

      Problem

      SELECT TO_NUMBER(NULL, NULL) makes a debug build abort in Protocol::end_statement(): the statement finished without OK, EOF or ERROR set in the diagnostics area.

      How to repeat

      Default sql_mode, no table:

      SELECT TO_NUMBER(NULL, NULL);

      Actual result

      Debug build, SIGABRT:

      sql/protocol.cc:639: void Protocol::end_statement(): Assertion `0' failed.
        Protocol::end_statement()
        dispatch_command(enum_server_command, THD*, char*, unsigned int, bool)
        do_command(THD*, bool)

      The assertion is the DA_EMPTY / default branch of the switch in Protocol::end_statement(). On a build without assertions the same branch falls through to send_ok(), there is no crash, and the client prints no result for the statement. Expected in both cases: a result set with one row containing NULL.

      Notes

      Found by calling every server function with one to three NULL arguments: this was the only crash among about 500 functions, and only with two arguments. I did not investigate the root cause (the format argument is a constant NULL; Item_func_to_number in sql/item_numconvfunc.cc caches a constant format at fix time, which is where I would look first, but I did not verify it). The code is unchanged on current main (checked against 52391ebe4feb56c8ccbbf33a29ea3acbb7b7cea7).

      Attachments

        Activity

          People

            External_Contributor External_Contributor
            hacker_zheng Wang Zheng
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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