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

Aria recovery: KEY_OP_MULTI_COPY reads from unchecked from+full_length in page buffer (OOB read)

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • 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_MULTI_COPY` as:
      ```c
      case KEY_OP_MULTI_COPY:
      full_length= uint2korr(header);
      header+= 2;
      log_memcpy_length= uint2korr(header);
      header+= 2;
      log_memcpy_end= header + log_memcpy_length;
      while (header < log_memcpy_end)

      { to= uint2korr(header); header+= 2; from= uint2korr(header); header+= 2; DBUG_ASSERT(MY_MAX(from, to) < max_page_size); memcpy(buff + to, buff + from, full_length); }

      ```
      This is the source/read side of the same opcode as the MULTI_COPY OOB-write issue: in release builds the asserts are no-ops, and there is no check that `from + full_length` stays inside the page (nor that the `(to,from)` list stays inside `header_end`).
      A corrupt `LOGREC_REDO_INDEX` can therefore cause an out-of-bounds read from the page buffer (often together with an OOB write to `to`).

        1. Impact
          Crash recovery / redo apply can crash or leak/corrupt memory when reading past the page on a malformed MULTI_COPY 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.