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

_ma_apply_redo_index: KEY_OP_MULTI_COPY memcpy uses unchecked to/from/full_length (page buffer OOB write)

    XMLWordPrintable

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.0.1
    • 10.11
    • 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
    • Q4/2026 Server Maintenance

    Description

      In storage/maria/ma_key_recover.c, _ma_apply_redo_index() handles KEY_OP_MULTI_COPY roughly as:

      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);
        }
      

      In release builds (DBUG_OFF), the asserts are no-ops. There is no runtime check that:

      • to + full_length / from + full_length stay inside the page buffer
      • log_memcpy_end stays inside the redo record (header_end)

      A corrupt LOGREC_REDO_INDEX applied during Aria recovery can therefore write past the page buffer.

      Impact

      Crash recovery / redo apply can crash or corrupt memory when processing a malformed MULTI_COPY redo record.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 3d
                  3d
                  Remaining:
                  Time Spent - 2d 3h 5m Remaining Estimate - 4h 55m
                  4h 55m
                  Logged:
                  Time Spent - 2d 3h 5m Remaining Estimate - 4h 55m
                  2d 3h 5m

                  Git Integration

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