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

UBSAN: runtime error: store to misaligned address for type 'uint32' (aka 'unsigned int'), which requires 4 byte alignment in extra/comp_err

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      Compilation error during UB+ASAN builds using Clang 21.1.0:

      CS 11.4.9 d098e615422266461b32c9922a1501d60a32f9d7 (Debug, UBASAN, Clang 21.1.0-20250811) Build 24/09/2025

      /test/11.4_dbg_san/extra/comp_err.c:398:5: runtime error: store to misaligned address 0x7aa942e09026 for type 'uint32' (aka 'unsigned int'), which requires 4 byte alignment
      0x7aa942e09026: note: pointer points here
       02 05 01 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00
                   ^ 
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /test/11.4_dbg_san/extra/comp_err.c:398:5 
      

      Code:

      extra/comp_err.c around line 398

          /* continue with header of the errmsg.sys file */
          length= (ulong) (my_ftell(to, MYF(0)) - HEADER_LENGTH -
                           (error_count + section_count) * 2);
          bzero((uchar*) head, HEADER_LENGTH);
          bmove((uchar*) head, (uchar*) file_head, 4);
          head[4]= 1;
          int4store(head + 6, length);                                        <<<<<<<<<<<<< Line 398
          int2store(head + 10, max_error);            /* Max error */
          int2store(head + 12, row_nr);
          int2store(head + 14, section_count);
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.