Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5, 10.6, 10.11, 11.4, 11.7, 11.8
Description
Observed with both InnoDB and MyISAM.
CREATE TABLE t (a INT,b CHAR,PRIMARY KEY(a,b)) PARTITION BY LINEAR KEY() PARTITIONS 2; |
EXPLAIN SELECT * FROM t WHERE a=1 OR a=2; |
Leads to:
CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Optimized, UBASAN, Clang) |
/test/10.5_opt_san/sql/opt_range.cc:9633:41: runtime error: applying non-zero offset 32 to null pointer
|
#0 0x55a879f15335 in sel_trees_must_be_ored(RANGE_OPT_PARAM*, SEL_TREE*, SEL_TREE*, Bitmap<64u>) /test/10.5_opt_san/sql/opt_range.cc:9633:41
|
#1 0x55a879f6a710 in tree_or(RANGE_OPT_PARAM*, SEL_TREE*, SEL_TREE*) /test/10.5_opt_san/sql/opt_range.cc:9849:24
|
#2 0x55a879f75aad in Item_cond::get_mm_tree(RANGE_OPT_PARAM*, Item**) /test/10.5_opt_san/sql/opt_range.cc:8497:13
|
#3 0x55a879f5bc37 in prune_partitions(THD*, TABLE*, Item*) /test/10.5_opt_san/sql/opt_range.cc:4069:22
|
#4 0x55a878967bf1 in JOIN::optimize_inner() /test/10.5_opt_san/sql/sql_select.cc:2290:9
|
#5 0x55a8789580f4 in JOIN::optimize() /test/10.5_opt_san/sql/sql_select.cc:1765:10
|
#6 0x55a87893266f in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /test/10.5_opt_san/sql/sql_select.cc:4904:19
|
#7 0x55a878aaa3c5 in mysql_explain_union(THD*, st_select_lex_unit*, select_result*) /test/10.5_opt_san/sql/sql_select.cc:28265:10
|
#8 0x55a87884779e in execute_sqlcom_select(THD*, TABLE_LIST*) /test/10.5_opt_san/sql/sql_parse.cc:6376:12
|
#9 0x55a87882baef in mysql_execute_command(THD*) /test/10.5_opt_san/sql/sql_parse.cc:4029:12
|
#10 0x55a8787f3168 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_opt_san/sql/sql_parse.cc:8237:18
|
#11 0x55a8787e6160 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_opt_san/sql/sql_parse.cc:1891:7
|
#12 0x55a8787f5ba9 in do_command(THD*) /test/10.5_opt_san/sql/sql_parse.cc:1375:17
|
#13 0x55a878efbf72 in do_handle_one_connection(CONNECT*, bool) /test/10.5_opt_san/sql/sql_connect.cc:1386:11
|
#14 0x55a878efb3d4 in handle_one_connection /test/10.5_opt_san/sql/sql_connect.cc:1298:5
|
#15 0x55a87825c10c in asan_thread_start(void*) asan_interceptors.cpp.o
|
#16 0x14d15ea9ca93 in start_thread nptl/pthread_create.c:447:8
|
#17 0x14d15eb29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
|
|
SUMMARY: UndefinedBehaviorSanitizer: nullptr-with-nonzero-offset /test/10.5_opt_san/sql/opt_range.cc:9633:41
|
CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN, Clang) |
/test/10.5_dbg_san/sql/opt_range.cc:9633:41: runtime error: applying non-zero offset 32 to null pointer
|
#0 0x555c42bc1917 in sel_trees_must_be_ored(RANGE_OPT_PARAM*, SEL_TREE*, SEL_TREE*, Bitmap<64u>) /test/10.5_dbg_san/sql/opt_range.cc:9633:41
|
#1 0x555c42c71227 in tree_or(RANGE_OPT_PARAM*, SEL_TREE*, SEL_TREE*) /test/10.5_dbg_san/sql/opt_range.cc:9849:24
|
#2 0x555c42c863ab in Item_cond::get_mm_tree(RANGE_OPT_PARAM*, Item**) /test/10.5_dbg_san/sql/opt_range.cc:8497:13
|
#3 0x555c42c4aa95 in prune_partitions(THD*, TABLE*, Item*) /test/10.5_dbg_san/sql/opt_range.cc:4069:22
|
#4 0x555c3fe9acc6 in JOIN::optimize_inner() /test/10.5_dbg_san/sql/sql_select.cc:2290:9
|
#5 0x555c3fe7a02d in JOIN::optimize() /test/10.5_dbg_san/sql/sql_select.cc:1765:10
|
#6 0x555c3fe2a9db in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /test/10.5_dbg_san/sql/sql_select.cc:4904:19
|
#7 0x555c4013af78 in mysql_explain_union(THD*, st_select_lex_unit*, select_result*) /test/10.5_dbg_san/sql/sql_select.cc:28265:10
|
#8 0x555c3fbffc19 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/10.5_dbg_san/sql/sql_parse.cc:6376:12
|
#9 0x555c3fb9759f in mysql_execute_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:4029:12
|
#10 0x555c3fb3e4e3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:8237:18
|
#11 0x555c3fb1e453 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:1891:7
|
#12 0x555c3fb46a19 in do_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:1375:17
|
#13 0x555c40ac0f30 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1386:11
|
#14 0x555c40abf6fd in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
|
#15 0x555c3efbaa8c in asan_thread_start(void*) asan_interceptors.cpp.o
|
#16 0x14bc3e29ca93 in start_thread nptl/pthread_create.c:447:8
|
#17 0x14bc3e329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
|
|
SUMMARY: UndefinedBehaviorSanitizer: nullptr-with-nonzero-offset /test/10.5_dbg_san/sql/opt_range.cc:9633:41
|
Setup:
Compiled with a recent version of Clang (I used Clang 18.1.3) with LLVM 18:
|
# llvm-17-linker-tools installs /usr/lib/llvm-17/lib/LLVMgold.so, which is needed for compilation, and LLVMgold.so is no longer included in LLVM 18
|
sudo apt install clang llvm-18 llvm-18-linker-tools llvm-18-runtime llvm-18-tools llvm-18-dev libstdc++-14-dev llvm-dev llvm-17-linker-tools
|
sudo ln -s /usr/lib/llvm-17/lib/LLVMgold.so /usr/lib/llvm-18/lib/LLVMgold.so
|
-DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWSREP_LIB_WITH_ASAN=ON
|
Set before execution:
|
export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1
|
Bug confirmed present in:
MariaDB: 10.5.28 (dbg), 10.5.28 (opt), 10.6.21 (dbg), 10.6.21 (opt), 10.11.11 (dbg), 10.11.11 (opt), 11.4.5 (dbg), 11.4.5 (opt), 11.7.1 (dbg), 11.7.1 (opt), 11.8.0 (dbg), 11.8.0 (opt)