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

String_copier::well_formed_copy inefficient for appending 0 bytes

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11, 11.4, 11.8, 12.3
    • 10.11
    • Data types
    • None

    Description

      When from_length is 0 on this function, it take a very convoluted path through character set functions to in the end, set this status to successful.

      This can happen in various ways storing of Field_str types.

      example

      #0  0x00000000041ce6b3 in my_scan_8bit (cs=0x7988400 <my_charset_utf8mb3_bin>, str=0x60dd <error: Cannot access memory at address 0x60dd>, 
          end=0x7b96d7415f38 "", sq=2) at /home/dan/repos/mariadb-server-11.8/strings/ctype-simple.c:1182
      #1  0x0000000000d9ca10 in charset_info_st::scan (this=0x7988400 <my_charset_utf8mb3_bin>, b=0x60dd <error: Cannot access memory at address 0x60dd>, 
          e=0x7b96d7415f38 "", seq=2) at /home/dan/repos/mariadb-server-11.8/include/m_ctype.h:1037
      #2  0x0000000001c1e345 in test_if_important_data (cs=0x7988400 <my_charset_utf8mb3_bin>, str=0x60dd <error: Cannot access memory at address 0x60dd>, 
          strend=0x7b96d7415f38 "") at /home/dan/repos/mariadb-server-11.8/sql/field.cc:1028
      #3  0x0000000001c6b939 in Field_longstr::report_if_important_data (this=0x7e36d74e62f8, pstr=0x60dd <error: Cannot access memory at address 0x60dd>, 
          end=0x7b96d7415f38 "", count_spaces=false) at /home/dan/repos/mariadb-server-11.8/sql/field.cc:7451
      #4  0x0000000001cb84ec in Field_longstr::check_conversion_status (this=0x7e36d74e62f8, copier=0x7b66d60e5d20, end=0x7b96d7415f38 "", 
          cs=0x7988400 <my_charset_utf8mb3_bin>, count_spaces=false) at /home/dan/repos/mariadb-server-11.8/sql/field.h:2296
      #5  0x0000000001ca91ef in Field_longstr::well_formed_copy_with_check (this=0x7e36d74e62f8, to=0x7d66d73e24d5 "", to_length=765, 
          from_cs=0x7988400 <my_charset_utf8mb3_bin>, from=0x7b96d7415f38 "", from_length=0, nchars=255, count_spaces=false, copy_length=0x7b66d5fc0de0)
          at /home/dan/repos/mariadb-server-11.8/sql/field.h:2311
      #6  0x0000000001c6c668 in Field_string::store (this=0x7e36d74e62f8, from=0x7b96d7415f38 "", length=0, cs=0x7988400 <my_charset_utf8mb3_bin>)
          at /home/dan/repos/mariadb-server-11.8/sql/field.cc:7532
      #7  0x0000000001da3207 in Item::save_str_value_in_field (this=0x7e36d74d7ef8, field=0x7e36d74e62f8, result=0x7e36d74d7f20)
          at /home/dan/repos/mariadb-server-11.8/sql/item.cc:426
      #8  0x0000000001dfefc4 in Item_string::save_in_field (this=0x7e36d74d7ef8, field=0x7e36d74e62f8, no_conversions=true)
          at /home/dan/repos/mariadb-server-11.8/sql/item.cc:7327
      #9  0x0000000001c1b200 in Field::make_empty_rec_store_default_value (this=0x7e36d74e62f8, thd=0x7e26d7500218, item=0x7e36d74d7ef8)
          at /home/dan/repos/mariadb-server-11.8/sql/field.cc:1584
      #10 0x000000000139586b in make_empty_rec_store_default (thd=0x7e26d7500218, regfield=0x7e36d74e62f8, field=0x7e36d74d6438)
          at /home/dan/repos/mariadb-server-11.8/sql/unireg.cc:1171
      #11 0x00000000013912dc in make_empty_rec (thd=0x7e26d7500218, buff=0x7d66d73e24d4 "\001", table_options=8, 
          create_fields=@0x7b66d63f7bf0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7e36d74d60a0, last = 0x7e36d74d6210, elements = 24}, <No data fields>}, reclength=1363, data_offset=1) at /home/dan/repos/mariadb-server-11.8/sql/unireg.cc:1246
      #12 0x0000000001386775 in build_frm_image (thd=0x7e26d7500218, table=@0x7b66d63f7b80: {str = 0x7e36d74d1428 "db", length = 2}, create_info=0x7b66d63f7870, 
          create_fields=@0x7b66d63f7bf0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7e36d74d60a0, last = 0x7e36d74d6210, elements = 24}, <No data fields>}, keys=2, key_info=0x7e36d74e60c0, db_file=0x7e36d74e5868) at /home/dan/repos/mariadb-server-11.8/sql/unireg.cc:576
      #13 0x000000000110e07b in mysql_create_frm_image (thd=0x7e26d7500218, create_info=0x7b66d63f7870, alter_info=0x7b66d63f7b70, create_table_mode=0, 
          key_info=0x7b66d6357c20, key_count=0x7b66d6357c40, frm=0x7b66d6357ee0) at /home/dan/repos/mariadb-server-11.8/sql/sql_table.cc:4590
      #14 0x00000000011221ce in create_table_impl (thd=0x7e26d7500218, ddl_log_state_create=0x7b66d6222220, ddl_log_state_rm=0x7b66d6222260, 
          orig_db=@0x7e36d74d14a8: {<Lex_ident_fs> = {<Lex_ident<Compare_table_names>> = {<Lex_cstring> = {<st_mysql_const_lex_string> = {str = 0x7e36d74d1468 "mysql", length = 5}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, 
          orig_table_name=@0x7e36d74d14b8: {<Lex_ident_fs> = {<Lex_ident<Compare_table_names>> = {<Lex_cstring> = {<st_mysql_const_lex_string> = {str = 0x7e36d74d1428 "db", length = 2}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, 
          db=@0x7e36d74d14a8: {str = 0x7e36d74d1468 "mysql", length = 5}, table_name=@0x7e36d74d14b8: {str = 0x7e36d74d1428 "db", length = 2}, 
          path=@0x7b66d6357f00: {str = 0x7b66d6357c50 "./mysql/db", length = 10}, options={m_options = DDL_options_st::OPT_IF_NOT_EXISTS}, 
          create_info=0x7b66d63f7870, alter_info=0x7b66d63f7b70, create_table_mode=0, is_trans=0x7b66d62222a0, key_info=0x7b66d6357c20, key_count=0x7b66d6357c40, 
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 2d 2.5h
                  2d 2.5h

                  Git Integration

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