Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.5.0
    • OTHER
    • None

    Description

      In many places in the code, a const qualifier can be added to TYPELIB pointers:

      Members:

      • Field_enum::typelib
      • Column_definition_attributes::interval
      • Create_field::save_interval
      • Item_type_holder::enum_set_typelib
      • Type_holder::m_typelib

      Return values in methods returning a TYPELIB pointer:

      • Field::get_typelib()
      • Type_all_attributes::get_typelib()

      Related method and function parameters getting a TYPELIB pointer should also be fixed accordingly.

      Attachments

        Issue Links

          Activity

            There was a bug in the patch. Fortunately ASAN found it.

            This patch fixes the problem

            - (uint *) thd->alloc(sizeof(uint) * field->interval->count+1);
            + (uint *) thd->alloc(sizeof(uint) * (field->interval->count+1));
            

            Function pack_header() in unireg.cc

            bar Alexander Barkov added a comment - There was a bug in the patch. Fortunately ASAN found it. This patch fixes the problem - (uint *) thd->alloc( sizeof (uint) * field->interval->count+1); + (uint *) thd->alloc( sizeof (uint) * (field->interval->count+1)); Function pack_header() in unireg.cc

            Pushed a cleanup patch:

            commit b3161bd99556dae6d27823e8572f822f1de8d137 (HEAD -> 10.5, origin/HEAD, origin/10.5)
            Author: Alexander Barkov <bar@mariadb.com>
            Date: Thu Jul 4 18:26:59 2019 +0400

            A cleanup (to fix ASAN problem) for MDEV-19863 Add const to TYPELIB pointers

            In this statement:

            (uint *) thd->alloc(sizeof(uint) * field->interval->count+1);

            parentheses around the '+' operator were missing. So too few memory
            was allocated, which caused ASAN builds to fail on these tests:

            innodb.innodb-ucs2
            parts.part_ctype_utf32
            main.mix2_myisam_ucs2
            main.case
            main.ctype_ucs
            main.ctype_utf16
            main.ctype_utf16_uca
            main.ctype_utf16le

            Fixed to a correct version with parentheses:

            (uint *) thd->alloc(sizeof(uint) * (field->interval->count+1));

            bar Alexander Barkov added a comment - Pushed a cleanup patch: commit b3161bd99556dae6d27823e8572f822f1de8d137 (HEAD -> 10.5, origin/HEAD, origin/10.5) Author: Alexander Barkov <bar@mariadb.com> Date: Thu Jul 4 18:26:59 2019 +0400 A cleanup (to fix ASAN problem) for MDEV-19863 Add const to TYPELIB pointers In this statement: (uint *) thd->alloc(sizeof(uint) * field->interval->count+1); parentheses around the '+' operator were missing. So too few memory was allocated, which caused ASAN builds to fail on these tests: innodb.innodb-ucs2 parts.part_ctype_utf32 main.mix2_myisam_ucs2 main.case main.ctype_ucs main.ctype_utf16 main.ctype_utf16_uca main.ctype_utf16le Fixed to a correct version with parentheses: (uint *) thd->alloc(sizeof(uint) * (field->interval->count+1));

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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