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

Server crash in TABLE_LIST::get_tablenr() when executing a prepared statement through COM_STMT_EXECUTE

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      A crafted binary-protocol prepared-statement execution crashes mariadbd.

      Steps to reproduce:
      1. Start a disposable MariaDB test server.
      2. Install dependency: pip install mysql-connector-python
      3. Run the attached reproducer:
      python3 reproduce.py -H <host> -P <port> -u <user> -p <password>

      The reproducer first executes the embedded setup SQL to recreate database `mydb` and prepare the minimized schema/data required by the crash. It then prepares a statement with COM_STMT_PREPARE and sends crafted COM_STMT_EXECUTE packet(s).

      Actual result:
      mariadbd crashes.

      Crash signature:
      sql/table.h:2708(TABLE_LIST::get_tablenr())

      Expected result:
      The server should return an error or reject the malformed/edge-case prepared-statement execution without crashing.

      Attachments:

      • reproduce.py
      • error.log

      Attachments

        1. error.log
          7 kB
          Hongbo Feng
        2. reproduce.py
          24 kB
          Hongbo Feng

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              ycybfhb Hongbo Feng
              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.