Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.2, 12.3
-
Can result in unexpected behaviour
Description
CREATE TABLE t (a BLOB); |
INSERT t VALUES ('abcdefghijklmnopqrstuvwz'); |
SELECT (SELECT MULTILINESTRING (d.a,d.a,d.a) FROM t) FROM t AS d GROUP BY d.a; |
Leads to:
|
CS 11.4.10 4cff562f3f89d4df03e09233d835d0451bc37cc4 (Optimized, UBASAN, Clang 18.1.3-11) Build 17/12/2025 |
/test/11.4_opt_san/sql/item_geofunc.cc:984:11: runtime error: load of value 1768449894, which is not a valid value for type 'enum Geometry::wkbType'
|
#0 0x5d250d5225e5 in Item_func_spatial_collection::val_str(String*) /test/11.4_opt_san/sql/item_geofunc.cc:984:11
|
#1 0x5d250cfa3f82 in Item_cache_str::cache_value() /test/11.4_opt_san/sql/item.cc:10873:19
|
#2 0x5d250d9463e9 in select_singlerow_subselect::send_data(List<Item>&) /test/11.4_opt_san/sql/sql_class.cc:3828:9
|
#3 0x5d250ded03ec in end_send(JOIN*, st_join_table*, bool) /test/11.4_opt_san/sql/sql_select.cc:25642:9
|
#4 0x5d250df82af7 in evaluate_join_record(JOIN*, st_join_table*, int) /test/11.4_opt_san/sql/sql_select.cc:24561:11
|
#5 0x5d250de5c5ca in sub_select(JOIN*, st_join_table*, bool) /test/11.4_opt_san/sql/sql_select.cc:24328:9
|
#6 0x5d250deea177 in do_select(JOIN*, Procedure*) /test/11.4_opt_san/sql/sql_select.cc:23839:14
|
#7 0x5d250dee754f in JOIN::exec_inner() /test/11.4_opt_san/sql/sql_select.cc:5106:50
|
#8 0x5d250dee4510 in JOIN::exec() /test/11.4_opt_san/sql/sql_select.cc:4897:8
|
#9 0x5d250d32f6cd in subselect_single_select_engine::exec() /test/11.4_opt_san/sql/item_subselect.cc:4202:23
|
#10 0x5d250d2ecd33 in Item_subselect::exec() /test/11.4_opt_san/sql/item_subselect.cc:817:21
|
#11 0x5d250d2f9582 in Item_singlerow_subselect::val_str(String*) /test/11.4_opt_san/sql/item_subselect.cc:1508:8
|
#12 0x5d250cfa3f82 in Item_cache_str::cache_value() /test/11.4_opt_san/sql/item.cc:10873:19
|
#13 0x5d250cfb6b4d in Item_cache_wrapper::cache() /test/11.4_opt_san/sql/item.cc:9214:15
|
#14 0x5d250cf83506 in Item_cache_wrapper::save_val(Field*) /test/11.4_opt_san/sql/item.cc:9240:3
|
#15 0x5d250df8f241 in copy_funcs(Item**, THD const*) /test/11.4_opt_san/sql/sql_select.cc:29984:11
|
#16 0x5d250df7cd1d in end_write(JOIN*, st_join_table*, bool) /test/11.4_opt_san/sql/sql_select.cc:25911:9
|
#17 0x5d250dfb5481 in AGGR_OP::put_record(bool) /test/11.4_opt_san/sql/sql_select.cc:33429:30
|
#18 0x5d250ded3f0e in AGGR_OP::put_record() /test/11.4_opt_san/sql/sql_select.h:1186:48
|
#19 0x5d250ded3f0e in sub_select_postjoin_aggr(JOIN*, st_join_table*, bool) /test/11.4_opt_san/sql/sql_select.cc:24012:13
|
#20 0x5d250df82af7 in evaluate_join_record(JOIN*, st_join_table*, int) /test/11.4_opt_san/sql/sql_select.cc:24561:11
|
#21 0x5d250de5c5ca in sub_select(JOIN*, st_join_table*, bool) /test/11.4_opt_san/sql/sql_select.cc:24328:9
|
#22 0x5d250deea177 in do_select(JOIN*, Procedure*) /test/11.4_opt_san/sql/sql_select.cc:23839:14
|
#23 0x5d250dee754f in JOIN::exec_inner() /test/11.4_opt_san/sql/sql_select.cc:5106:50
|
#24 0x5d250dee4510 in JOIN::exec() /test/11.4_opt_san/sql/sql_select.cc:4897:8
|
#25 0x5d250de60812 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/11.4_opt_san/sql/sql_select.cc:5416:21
|
#26 0x5d250de5ef10 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.4_opt_san/sql/sql_select.cc:643:10
|
#27 0x5d250dd3c66d in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.4_opt_san/sql/sql_parse.cc:6223:12
|
#28 0x5d250dd1d0ed in mysql_execute_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:3986:12
|
#29 0x5d250dcfea90 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.4_opt_san/sql/sql_parse.cc:7944:18
|
#30 0x5d250dcf5ced in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.4_opt_san/sql/sql_parse.cc:1920:7
|
#31 0x5d250dd00d56 in do_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:1433:17
|
#32 0x5d250e43b03c in do_handle_one_connection(CONNECT*, bool) /test/11.4_opt_san/sql/sql_connect.cc:1497:11
|
#33 0x5d250e43a88a in handle_one_connection /test/11.4_opt_san/sql/sql_connect.cc:1409:5
|
#34 0x5d250cc6a38c in asan_thread_start(void*) crtstuff.c
|
#35 0x79411969caa3 in start_thread nptl/pthread_create.c:447:8
|
#36 0x794119729c6b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
|
 |
SUMMARY: UndefinedBehaviorSanitizer: invalid-enum-load /test/11.4_opt_san/sql/item_geofunc.cc:984:11
|
Setup:
Compiled with a recent version of Clang and LLVM. Ubuntu instructions for Clang/LLVM 18:
|
# Note: It is strongly recommended to uninstall all old Clang & LLVM packages (ref dpkg --list | grep -iE 'clang|llvm' and use apt purge and dpkg --purge to remove the packages), before installing Clang/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 lld-18
|
Compiled with: "-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C{,XX}_FLAGS='-march=native -mtune=native'" and:
|
-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 # And you may also want to supress UBSAN startup issues using 'suppressions=UBSAN.filter' in UBSAN_OPTIONS. For an example of UBSAN.filter, which includes current startup issues see: https://github.com/mariadb-corporation/mariadb-qa/blob/master/UBSAN.filter
|
|
SAN Bug Detection Matrix |
Rel o/d Build Commit UniqueID observed
|
CS 10.6 dbg 050126 b64db51ad89d78e6a6f8bc238dd2e208b5f7aa92 No bug found
|
CS 10.6 opt 050126 b64db51ad89d78e6a6f8bc238dd2e208b5f7aa92 No bug found
|
CS 10.11 opt 050126 0ac1c08b1a72c0265fced2a1a2d0ca54c0846f0d UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|end_send
|
CS 10.11 dbg 050126 0ac1c08b1a72c0265fced2a1a2d0ca54c0846f0d UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|end_send
|
CS 11.4 dbg 171225 4cff562f3f89d4df03e09233d835d0451bc37cc4 UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|end_send
|
CS 11.4 opt 171225 4cff562f3f89d4df03e09233d835d0451bc37cc4 UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|end_send
|
CS 11.8 dbg 171225 a7528a6190807281d3224e4e67a9b76083a202a6 UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|end_send
|
CS 11.8 opt 171225 a7528a6190807281d3224e4e67a9b76083a202a6 UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|end_send
|
CS 12.2 dbg 171225 997d0c4dfc551ea54faa1e9b7d56f3a0ff2ca849 UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|select_result_sink::send_data_with_check
|
CS 12.2 opt 171225 997d0c4dfc551ea54faa1e9b7d56f3a0ff2ca849 UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|select_result_sink::send_data_with_check
|
CS 12.3 dbg 151225 5879c85f505d3a11d4b8f479f2437416d8a1d724 UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|select_result_sink::send_data_with_check
|
CS 12.3 opt 151225 5879c85f505d3a11d4b8f479f2437416d8a1d724 UBSAN|load of value X, which is not a valid value for type 'enum Geometry::wkbType'|sql/item_geofunc.cc|Item_func_spatial_collection::val_str|Item_cache_str::cache_value|select_singlerow_subselect::send_data|select_result_sink::send_data_with_check
|