Valgrind warning "Use of uninitialised value of size 4" at my_strnncollsp_simple

Bug #666322 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Invalid
Undecided
Unassigned

Bug 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.

Tags: rqg valgrind
Revision history for this message
Philip Stoev (pstoev-askmonty) wrote :

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 ;

Changed in maria:
milestone: none → 5.3
assignee: nobody → Igor Babaev (igorb-seattle)
Revision history for this message
Philip Stoev (pstoev-askmonty) wrote :

Also reproducible with maria-5.3

Changed in maria:
assignee: Igor Babaev (igorb-seattle) → nobody
tags: removed: mwl128 wl128
summary: Valgrind warning "Use of uninitialised value of size 4" at
- my_strnncollsp_simple in maria-5.3-mwl128
+ my_strnncollsp_simple
Revision history for this message
Timour Katchaounov (timour) wrote :

No longer reproducible with the latest 5.3 as of 14-06-2011, tip:
------------------------------------------------------------
revno: 3041
committer: Sergey Petrunya <email address hidden>
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 <email address hidden> moved this loop from one place
  to another, then the merge of <email address hidden> have
  kept both copies).
------------------------------------------------------------

Changed in maria:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.