Bug #68706 Valgrind warnings (uninitialised value(s)) in hp_search with UNCOMPRESSED_LENGTH
Submitted: 18 Mar 2013 18:51 Modified: 11 Apr 2018 12:11
Reporter: Elena Stepanova Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.6.10, 5.6.12, 5.7.2, 5.5.32, 5.1.70 OS:Any
Assigned to: CPU Architecture:Any

[18 Mar 2013 18:51] Elena Stepanova
Description:
==28416== Thread 18:
==28416== Conditional jump or move depends on uninitialised value(s)
==28416==    at 0xB49D4A: hp_mask (hp_hash.c:213)
==28416==    by 0xB49979: hp_search (hp_hash.c:114)
==28416==    by 0xB4D4D0: heap_rkey (hp_rkey.c:61)
==28416==    by 0xB4723F: ha_heap::index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) (ha_heap.cc:288)
==28416==    by 0x6180D9: handler::ha_index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) (handler.cc:2668)
==28416==    by 0x77C246: end_update(JOIN*, st_join_table*, bool) (sql_executor.cc:3022)
==28416==    by 0x77F855: QEP_tmp_table::put_record(bool) (sql_executor.cc:4264)
==28416==    by 0x780312: QEP_tmp_table::put_record() (sql_executor.h:241)
==28416==    by 0x777E92: sub_select_op(JOIN*, st_join_table*, bool) (sql_executor.cc:1067)
==28416==    by 0x778B47: evaluate_join_record(JOIN*, st_join_table*) (sql_executor.cc:1601)
==28416==    by 0x778176: sub_select(JOIN*, st_join_table*, bool) (sql_executor.cc:1276)
==28416==    by 0x777AF0: do_select(JOIN*) (sql_executor.cc:941)
==28416==    by 0x775B3F: JOIN::exec() (sql_executor.cc:191)
==28416==    by 0x7D2BD0: mysql_execute_select(THD*, st_select_lex*, bool) (sql_select.cc:1100)
==28416==    by 0x7D2EB5: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<st_order>*, SQL_I_List<st_order>*, Item*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:1221)
==28416==    by 0x7D1003: handle_select(THD*, select_result*, unsigned long) (sql_select.cc:110)
==28416== Conditional jump or move depends on uninitialised value(s)
==28416==    at 0x4C2DCB3: bcmp (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28416==    by 0xB4AB6E: hp_key_cmp (hp_hash.c:667)
==28416==    by 0xB499A6: hp_search (hp_hash.c:118)
==28416==    by 0xB4D4D0: heap_rkey (hp_rkey.c:61)
==28416==    by 0xB4723F: ha_heap::index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) (ha_heap.cc:288)
==28416==    by 0x6180D9: handler::ha_index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) (handler.cc:2668)
==28416==    by 0x77C246: end_update(JOIN*, st_join_table*, bool) (sql_executor.cc:3022)
==28416==    by 0x77F855: QEP_tmp_table::put_record(bool) (sql_executor.cc:4264)
==28416==    by 0x780312: QEP_tmp_table::put_record() (sql_executor.h:241)
==28416==    by 0x777E92: sub_select_op(JOIN*, st_join_table*, bool) (sql_executor.cc:1067)
==28416==    by 0x778B47: evaluate_join_record(JOIN*, st_join_table*) (sql_executor.cc:1601)
==28416==    by 0x778176: sub_select(JOIN*, st_join_table*, bool) (sql_executor.cc:1276)
==28416==    by 0x777AF0: do_select(JOIN*) (sql_executor.cc:941)
==28416==    by 0x775B3F: JOIN::exec() (sql_executor.cc:191)
==28416==    by 0x7D2BD0: mysql_execute_select(THD*, st_select_lex*, bool) (sql_select.cc:1100)
==28416==    by 0x7D2EB5: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<st_order>*, SQL_I_List<st_order>*, Item*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:1221)
==28416== Conditional jump or move depends on uninitialised value(s)
==28416==    at 0x4C2DCD3: bcmp (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28416==    by 0xB4AB6E: hp_key_cmp (hp_hash.c:667)
==28416==    by 0xB499A6: hp_search (hp_hash.c:118)
==28416==    by 0xB4D4D0: heap_rkey (hp_rkey.c:61)
==28416==    by 0xB4723F: ha_heap::index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) (ha_heap.cc:288)
==28416==    by 0x6180D9: handler::ha_index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) (handler.cc:2668)
==28416==    by 0x77C246: end_update(JOIN*, st_join_table*, bool) (sql_executor.cc:3022)
==28416==    by 0x77F855: QEP_tmp_table::put_record(bool) (sql_executor.cc:4264)
==28416==    by 0x780312: QEP_tmp_table::put_record() (sql_executor.h:241)
==28416==    by 0x777E92: sub_select_op(JOIN*, st_join_table*, bool) (sql_executor.cc:1067)
==28416==    by 0x778B47: evaluate_join_record(JOIN*, st_join_table*) (sql_executor.cc:1601)
==28416==    by 0x778176: sub_select(JOIN*, st_join_table*, bool) (sql_executor.cc:1276)
==28416==    by 0x777AF0: do_select(JOIN*) (sql_executor.cc:941)
==28416==    by 0x775B3F: JOIN::exec() (sql_executor.cc:191)
==28416==    by 0x7D2BD0: mysql_execute_select(THD*, st_select_lex*, bool) (sql_select.cc:1100)
==28416==    by 0x7D2EB5: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<st_order>*, SQL_I_List<st_order>*, Item*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:1221)
==28416== Conditional jump or move depends on uninitialised value(s)
==28416==    at 0xB4AB71: hp_key_cmp (hp_hash.c:667)
==28416==    by 0xB499A6: hp_search (hp_hash.c:118)
==28416==    by 0xB4D4D0: heap_rkey (hp_rkey.c:61)
==28416==    by 0xB4723F: ha_heap::index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) (ha_heap.cc:288)
==28416==    by 0x6180D9: handler::ha_index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) (handler.cc:2668)
==28416==    by 0x77C246: end_update(JOIN*, st_join_table*, bool) (sql_executor.cc:3022)
==28416==    by 0x77F855: QEP_tmp_table::put_record(bool) (sql_executor.cc:4264)
==28416==    by 0x780312: QEP_tmp_table::put_record() (sql_executor.h:241)
==28416==    by 0x777E92: sub_select_op(JOIN*, st_join_table*, bool) (sql_executor.cc:1067)
==28416==    by 0x778B47: evaluate_join_record(JOIN*, st_join_table*) (sql_executor.cc:1601)
==28416==    by 0x778176: sub_select(JOIN*, st_join_table*, bool) (sql_executor.cc:1276)
==28416==    by 0x777AF0: do_select(JOIN*) (sql_executor.cc:941)
==28416==    by 0x775B3F: JOIN::exec() (sql_executor.cc:191)
==28416==    by 0x7D2BD0: mysql_execute_select(THD*, st_select_lex*, bool) (sql_select.cc:1100)
==28416==    by 0x7D2EB5: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<st_order>*, SQL_I_List<st_order>*, Item*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:1221)
==28416==    by 0x7D1003: handle_select(THD*, select_result*, unsigned long) (sql_select.cc:110)

How to repeat:
CREATE TABLE t1 (pk CHAR(3) PRIMARY KEY);
INSERT INTO t1 VALUES ('abc'),('def');
SELECT MIN( pk ) FROM t1 GROUP BY UNCOMPRESSED_LENGTH( pk );
[18 Mar 2013 20:09] Sveta Smirnova
Thank you for the report.

Verified as described.
[11 Apr 2018 12:11] Erlend Dahl
This doesn't seem to be reproducible on latest versions.