[MDEV-31201] LeakSanitizer errors in String::real_alloc / cmp_item_sort_string_in_static::store_value Created: 2023-05-05  Updated: 2023-05-12  Resolved: 2023-05-12

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.3
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Elena Stepanova
Resolution: Won't Fix Votes: 0
Labels: not-10.4+


 Description   

CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
SELECT * FROM t1 WHERE ('62','0') IN ((62,NULL),(62,56));
 
# Cleanup
DROP TABLE t1;

10.3 55a53949

==166365==ERROR: LeakSanitizer: detected memory leaks
 
Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f8b094b89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x55dc8f2eaa44 in my_malloc /data/src/10.3/mysys/my_malloc.c:101
    #2 0x55dc8d982f86 in String::real_alloc(unsigned long) /data/src/10.3/sql/sql_string.cc:44
    #3 0x55dc8d4e87f7 in String::alloc(unsigned long) /data/src/10.3/sql/sql_string.h:383
    #4 0x55dc8d9836c0 in String::set_int(long long, bool, charset_info_st const*) /data/src/10.3/sql/sql_string.cc:127
    #5 0x55dc8df3bad6 in Item_int::val_str(String*) /data/src/10.3/sql/item.cc:3771
    #6 0x55dc8dfda44e in cmp_item_sort_string_in_static::store_value(Item*) /data/src/10.3/sql/item_cmpfunc.h:1725
    #7 0x55dc8dc9131a in cmp_item::store_value_by_template(THD*, cmp_item*, Item*) /data/src/10.3/sql/item_cmpfunc.h:1516
    #8 0x55dc8dfb97d3 in cmp_item_row::store_value_by_template(THD*, cmp_item*, Item*) /data/src/10.3/sql/item_cmpfunc.cc:3966
    #9 0x55dc8dfb62d9 in in_row::set(unsigned int, Item*) /data/src/10.3/sql/item_cmpfunc.cc:3645
    #10 0x55dc8dfbbc0e in Item_func_in::fix_in_vector() /data/src/10.3/sql/item_cmpfunc.cc:4271
    #11 0x55dc8dfbc936 in Item_func_in::fix_for_row_comparison_using_bisection(THD*) /data/src/10.3/sql/item_cmpfunc.cc:4374
    #12 0x55dc8dc7aed6 in Type_handler_row::Item_func_in_fix_comparator_compatible_types(THD*, Item_func_in*) const /data/src/10.3/sql/sql_type.cc:4017
    #13 0x55dc8dfbb7cc in Item_func_in::fix_length_and_dec() /data/src/10.3/sql/item_cmpfunc.cc:4238
    #14 0x55dc8e01c5ff in Item_func::fix_fields(THD*, Item**) /data/src/10.3/sql/item_func.cc:370
    #15 0x55dc8dfbae00 in Item_func_in::fix_fields(THD*, Item**) /data/src/10.3/sql/item_cmpfunc.cc:4163
    #16 0x55dc8d50b2ca in Item::fix_fields_if_needed(THD*, Item**) /data/src/10.3/sql/item.h:831
    #17 0x55dc8d50b300 in Item::fix_fields_if_needed_for_scalar(THD*, Item**) /data/src/10.3/sql/item.h:835
    #18 0x55dc8d62de78 in Item::fix_fields_if_needed_for_bool(THD*, Item**) /data/src/10.3/sql/item.h:839
    #19 0x55dc8d625a9e in setup_conds(THD*, TABLE_LIST*, List<TABLE_LIST>&, Item**) /data/src/10.3/sql/sql_base.cc:8353
    #20 0x55dc8d8160ce in setup_without_group /data/src/10.3/sql/sql_select.cc:675
    #21 0x55dc8d81c45a in JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /data/src/10.3/sql/sql_select.cc:1181
    #22 0x55dc8d83dec5 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.3/sql/sql_select.cc:4371
    #23 0x55dc8d8de4b4 in mysql_explain_union(THD*, st_select_lex_unit*, select_result*) /data/src/10.3/sql/sql_select.cc:26567
    #24 0x55dc8d787e33 in execute_sqlcom_select /data/src/10.3/sql/sql_parse.cc:6279
    #25 0x55dc8d7764b6 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:3871
    #26 0x55dc8d79217f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7855
    #27 0x55dc8d768fae in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1852
    #28 0x55dc8d765b46 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1398
    #29 0x55dc8db2df5b in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1404
 
SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).

Not reproducible on 10.4+, even on 10.4.6.
I didn't bisect for the fix, as such old releases don't build well locally anymore.



 Comments   
Comment by Elena Stepanova [ 2023-05-12 ]

Closing as "won't fix" as 10.3 goes EOL now.

Generated at Thu Feb 08 10:22:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.