Valgrind warning "Use of uninitialised value of size 4" at my_strnncollsp_simple
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_
==18898== by 0x825776D: Field_varstring
==18898== by 0x8261955: Field_varstring
==18898== by 0x81E0E46: Field::cmp(unsigned char const*) (field.h:314)
==18898== by 0x81E0C37: Cached_
==18898== by 0x8329D34: test_if_
==18898== by 0x83228A8: end_send_
==18898== by 0x8320A19: evaluate_
==18898== by 0x832050E: sub_select(JOIN*, st_join_table*, bool) (sql_select.
==18898== by 0x8320A19: evaluate_
==18898== by 0x83203C0: sub_select(JOIN*, st_join_table*, bool) (sql_select.
==18898== by 0x831F7E1: do_select(JOIN*, List<Item>*, st_table*, Procedure*) (sql_select.
==18898== by 0x83057B6: JOIN::exec() (sql_select.
==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_
==18898== by 0x82FE59A: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:277)
==18898== by 0x829B753: execute_
==18898==
in maria-5.3-mwl128 and not in 5.3-main. The EXPLAIN plan does not show any join_cache involvement.
Test case:
CREATE TABLE `C` ( key`,`col_ int_key` )
`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_
) 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 ;