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

Aria recovery: KEY_OP_CHANGE copies log-provided length without checking header_end (OOB read)

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.0.1
    • None
    • Storage Engine - Aria
    • None
    • MariaDB Server 13.0.1 (tag mariadb-13.0.1); also present on main tip. Confirmed by source review on macOS arm64.
    • Can result in hang or crash
    • Q3/2026 Server Development

    Description

      In `storage/maria/ma_key_recover.c`, `_ma_apply_redo_index()` handles `KEY_OP_CHANGE` as:
      ```c
      case KEY_OP_CHANGE:
      uint length= uint2korr(header);
      DBUG_ASSERT(page_offset != 0 && page_offset + length <= page_length);
      memcpy(buff + page_offset, header + 2, length);
      page_offset+= length;
      header+= 2 + length;
      ```
      There is no check that `header + 2 + length <= header_end` before reading from the redo buffer. In release builds the page-side `DBUG_ASSERT` is also a no-op.
      A truncated or corrupt `LOGREC_REDO_INDEX` can therefore cause an out-of-bounds read from the log record (and may write past the page if `page_offset + length` is also unchecked).

        1. Impact
          Crash recovery / redo apply can crash or read past the redo buffer on a malformed CHANGE record.

      Attachments

        Activity

          People

            Khaled.amr Khaled Amr
            sxt shixin tan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 3d
                3d
                Remaining:
                Remaining Estimate - 3d
                3d
                Logged:
                Time Spent - Not Specified
                Not Specified

                Git Integration

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