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

Server crash in Item_field::type_handler() 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/item.h:3919(Item_field::type_handler() const)

      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
          10 kB
        2. mdev-40303.test
          19 kB
        3. reproduce.py
          32 kB

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              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.