Bug #91059 clang/ubsan misc runtime errors
Submitted: 29 May 2018 12:21 Modified: 8 Jun 2018 15:21
Reporter: Tor Didriksen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[29 May 2018 12:21] Tor Didriksen
Description:
Fix misc clang/ubsan errors in the default mtr test suite.

How to repeat:
Build with clang/ubsan

innodb.autoinc_persist
storage/innobase/include/row0row.ic:188:40: runtime error: -1 is outside the range of representable values of type 'unsigned long'

    #0 0xa5b8bed in row_parse_int(unsigned char const*, unsigned long, unsigned long, bool) storage/innobase/include/row0row.ic:188:40
    #1 0xa5adf66 in row_parse_int_from_field(dfield_t const*) storage/innobase/row/row0row.cc:975:13
    #2 0xa5ae065 in row_get_autoinc_counter(dtuple_t const*, unsigned long) storage/innobase/row/row0row.cc:986:11
    #3 0xa47e8e7 in row_ins_clust_index_entry_low(unsigned long, unsigned long, dict_index_t*, unsigned long, dtuple_t*, unsigned long, que_thr_t*, bool) storage/innobase/row/row0ins.cc:2427:9

main.myisampack
mysys/tree.cc:505:18: runtime error: call to function save_counts_in_queue(unsigned char*, unsigned int, HUFF_TREE*) through pointer to incorrect function type 'int (*)(void *, unsigned int, void *)'

    #0 0x7c7884 in tree_walk_left_root_right(TREE*, TREE_ELEMENT*, int (*)(void*, unsigned int, void*), void*) mysys/tree.cc:505:18
    #1 0x7c7641 in tree_walk(TREE*, int (*)(void*, unsigned int, void*), void*, TREE_WALK) mysys/tree.cc:491:14
    #2 0x4d4871 in make_huff_tree(HUFF_TREE*, HUFF_COUNTS*) storage/myisam/myisampack.cc:1429:5
    #3 0x4b6199 in check_counts(HUFF_COUNTS*, unsigned int, unsigned long long) storage/myisam/myisampack.cc:1216:12
    #4 0x4aa35f in compress(PACK_MRG_INFO*, char*) storage/myisam/myisampack.cc:549:3
    #5 0x4a5d11 in main storage/myisam/myisampack.cc:248:13
    #6 0x7fe3fc155009 in __libc_start_main (/lib64/libc.so.6+0x21009)
    #7 0x47f7f9 in _start (bin-club/runtime_output_directory/myisampack+0x47f7f9)

i_main.gis
sql/item_func.cc:1177:24: runtime error: -1.84467e+19 is outside the range of representable values of type 'long long'

    #0 0x59faeeb in Item_func_numhybrid::val_int() item_func.cc:1177:24
    #1 0x5beee43 in Item_func_export_set::val_str(String*) item_strfunc.cc:3418:49
    #2 0x6546b58 in Item_func_geometry_from_wkb::val_str(String*) item_geofunc.cc:733:26
    #3 0x577ea1a in Item::send(Protocol*, String*) item.cc:6485:18

i_main.subquery
sql/sql_executor.cc:3131:62: runtime error: member access within null pointer of type 'TABLE'
    #0 0x62866f8 in get_exact_record_count(QEP_TAB*, unsigned int, int*) sql/sql_executor.cc:3131:62
    #1 0x6287424 in end_send_count(JOIN*, QEP_TAB*) sql/sql_executor.cc:3153:25
    #2 0x6244614 in do_select(JOIN*) sql/sql_executor.cc:1163:13
    #3 0x6242304 in JOIN::exec() sql/sql_executor.cc:294:11
    #4 0x4783971 in Sql_cmd_dml::execute_inner(THD*) sql/sql_select.cc:651:35
    #5 0x4781316 in Sql_cmd_dml::execute(THD*) sql/sql_select.cc:554:7

Suggested fix:
See suggested patch.
[8 Jun 2018 15:21] Paul DuBois
Posted by developer:
 
Fixed in 8.0.13.

Code cleanup. No changelog entry needed.