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

LP:666322 - Valgrind warning "Use of uninitialised value of size 4" at my_strnncollsp_simple

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Not a Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The following query:

      SELECT table2 . `col_varchar_key` AS field1
      FROM ( C AS table1 INNER JOIN C AS table2 ON (table2 . `col_int_key` = table1 . `col_int_key` ) )
      GROUP BY field1 HAVING field1 < 1 ORDER BY field1 ;

      produces the following valgrind warning:

      ==18898== Use of uninitialised value of size 4
      ==18898== at 0x8768836: my_strnncollsp_simple (ctype-simple.c:166)
      ==18898== by 0x825776D: Field_varstring::cmp_max(unsigned char const*, unsigned char const*, unsigned int) (field.cc:7140)
      ==18898== by 0x8261955: Field_varstring::cmp(unsigned char const*, unsigned char const*) (field.h:1669)
      ==18898== by 0x81E0E46: Field::cmp(unsigned char const*) (field.h:314)
      ==18898== by 0x81E0C37: Cached_item_field::cmp() (item_buff.cc:122)
      ==18898== by 0x8329D34: test_if_group_changed(List<Cached_item>&) (sql_select.cc:17230)
      ==18898== by 0x83228A8: end_send_group(JOIN*, st_join_table*, bool) (sql_select.cc:14324)
      ==18898== by 0x8320A19: evaluate_join_record(JOIN*, st_join_table*, int) (sql_select.cc:13490)
      ==18898== by 0x832050E: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:13338)
      ==18898== by 0x8320A19: evaluate_join_record(JOIN*, st_join_table*, int) (sql_select.cc:13490)
      ==18898== by 0x83203C0: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:13298)
      ==18898== by 0x831F7E1: do_select(JOIN*, List<Item>, st_table, Procedure*) (sql_select.cc:12842)
      ==18898== by 0x83057B6: JOIN::exec() (sql_select.cc:2412)
      ==18898== by 0x8305EDF: mysql_select(THD*, Item**, TABLE_LIST, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2613)
      ==18898== by 0x82FE59A: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:277)
      ==18898== by 0x829B753: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5081)
      ==18898==

      in maria-5.3-mwl128 and not in 5.3-main. The EXPLAIN plan does not show any join_cache involvement.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            philipstoev Philip Stoev added a comment -

            Re: Valgrind warning "Use of uninitialised value of size 4" at my_strnncollsp_simple in maria-5.3-mwl128
            Test case:

            CREATE TABLE `C` (
            `col_int_key` int(11) DEFAULT NULL,
            `col_varchar_key` varchar(1) DEFAULT NULL,
            KEY `col_int_key` (`col_int_key`),
            KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
            ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
            INSERT INTO `C` VALUES (0,NULL);
            INSERT INTO `C` VALUES (1,'c');
            INSERT INTO `C` VALUES (2,'d');
            INSERT INTO `C` VALUES (166,'e');
            INSERT INTO `C` VALUES (6,'f');
            INSERT INTO `C` VALUES (8,'h');
            INSERT INTO `C` VALUES (3,'j');
            INSERT INTO `C` VALUES (5,'k');
            INSERT INTO `C` VALUES (9,'k');
            INSERT INTO `C` VALUES (3,'m');
            INSERT INTO `C` VALUES (9,'m');
            INSERT INTO `C` VALUES (9,'m');
            INSERT INTO `C` VALUES (3,'n');
            INSERT INTO `C` VALUES (53,'o');
            INSERT INTO `C` VALUES (NULL,'r');
            INSERT INTO `C` VALUES (0,'t');
            INSERT INTO `C` VALUES (9,'t');
            INSERT INTO `C` VALUES (8,'u');
            INSERT INTO `C` VALUES (2,'w');
            INSERT INTO `C` VALUES (5,'y');

            SELECT table2 . `col_varchar_key` AS field1
            FROM ( C AS table1 INNER JOIN C AS table2 ON (table2 . `col_int_key` = table1 . `col_int_key` ) )
            GROUP BY field1 HAVING field1 < 1 ORDER BY field1 ;

            Show
            philipstoev Philip Stoev added a comment - Re: Valgrind warning "Use of uninitialised value of size 4" at my_strnncollsp_simple in maria-5.3-mwl128 Test case: CREATE TABLE `C` ( `col_int_key` int(11) DEFAULT NULL, `col_varchar_key` varchar(1) DEFAULT NULL, KEY `col_int_key` (`col_int_key`), KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `C` VALUES (0,NULL); INSERT INTO `C` VALUES (1,'c'); INSERT INTO `C` VALUES (2,'d'); INSERT INTO `C` VALUES (166,'e'); INSERT INTO `C` VALUES (6,'f'); INSERT INTO `C` VALUES (8,'h'); INSERT INTO `C` VALUES (3,'j'); INSERT INTO `C` VALUES (5,'k'); INSERT INTO `C` VALUES (9,'k'); INSERT INTO `C` VALUES (3,'m'); INSERT INTO `C` VALUES (9,'m'); INSERT INTO `C` VALUES (9,'m'); INSERT INTO `C` VALUES (3,'n'); INSERT INTO `C` VALUES (53,'o'); INSERT INTO `C` VALUES (NULL,'r'); INSERT INTO `C` VALUES (0,'t'); INSERT INTO `C` VALUES (9,'t'); INSERT INTO `C` VALUES (8,'u'); INSERT INTO `C` VALUES (2,'w'); INSERT INTO `C` VALUES (5,'y'); SELECT table2 . `col_varchar_key` AS field1 FROM ( C AS table1 INNER JOIN C AS table2 ON (table2 . `col_int_key` = table1 . `col_int_key` ) ) GROUP BY field1 HAVING field1 < 1 ORDER BY field1 ;
            Hide
            philipstoev Philip Stoev added a comment -

            Re: Valgrind warning "Use of uninitialised value of size 4" at my_strnncollsp_simple in maria-5.3-mwl128
            Also reproducible with maria-5.3

            Show
            philipstoev Philip Stoev added a comment - Re: Valgrind warning "Use of uninitialised value of size 4" at my_strnncollsp_simple in maria-5.3-mwl128 Also reproducible with maria-5.3
            Hide
            timour Timour Katchaounov added a comment -

            Re: Valgrind warning "Use of uninitialised value of size 4" at my_strnncollsp_simple
            No longer reproducible with the latest 5.3 as of 14-06-2011, tip:
            ------------------------------------------------------------
            revno: 3041
            committer: Sergey Petrunya <psergey@askmonty.org>
            branch nick: 5.3-push3
            timestamp: Mon 2011-06-13 12:41:19 +0400
            message:
            Remove redundant code that is a result of a wrong merge.
            (Changeset sp1r-igor@olga.mysql.com-20070526173301-38848 moved this loop from one place
            to another, then the merge of sp1r-gshchepa/uchum@gleb.loc-20070527192244-26330 have
            kept both copies).
            ------------------------------------------------------------

            Show
            timour Timour Katchaounov added a comment - Re: Valgrind warning "Use of uninitialised value of size 4" at my_strnncollsp_simple No longer reproducible with the latest 5.3 as of 14-06-2011, tip: ------------------------------------------------------------ revno: 3041 committer: Sergey Petrunya <psergey@askmonty.org> branch nick: 5.3-push3 timestamp: Mon 2011-06-13 12:41:19 +0400 message: Remove redundant code that is a result of a wrong merge. (Changeset sp1r-igor@olga.mysql.com-20070526173301-38848 moved this loop from one place to another, then the merge of sp1r-gshchepa/uchum@gleb.loc-20070527192244-26330 have kept both copies). ------------------------------------------------------------
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 666322

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 666322

              People

              • Assignee:
                Unassigned
                Reporter:
                philipstoev Philip Stoev
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: