Skip to content

Commit db3e1ed

Browse files
committed
MDEV-36814 MariaDB 10.11.9 Signal 11 crash on second Stored Procedure call
don't reset thd->lex->current_select, it's not a leftover from previous parsing, it's set in reinit_stmt_before_use()
1 parent 9a51709 commit db3e1ed

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

mysql-test/main/sp-bugs2.result

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,21 @@ t1test(1)
4242
wrbyviwb
4343
drop function t1test;
4444
drop table t1;
45+
#
46+
# MDEV-36814 MariaDB 10.11.9 Signal 11 crash on second Stored Procedure call
47+
#
48+
set names utf8;
49+
create table t1 (a varchar(1000));
50+
create procedure p1(in p_a varchar(1000)) insert into t1 values (p_a);//
51+
create procedure p2(in s varchar(10))
52+
begin
53+
if s = '1' then set @startDate = now(); end if;
54+
if s = '2' then set @startDate = '2025-05-23'; end if;
55+
call p1(concat(s, @startDate, ' and '));
56+
end;//
57+
call p2('1');
58+
call p2('2');
59+
drop table t1;
60+
drop procedure p1;
61+
drop procedure p2;
4562
# End of 10.11 tests

mysql-test/main/sp-bugs2.test

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,24 @@ select t1test(1);
4747
drop function t1test;
4848
drop table t1;
4949

50+
--echo #
51+
--echo # MDEV-36814 MariaDB 10.11.9 Signal 11 crash on second Stored Procedure call
52+
--echo #
53+
set names utf8;
54+
create table t1 (a varchar(1000));
55+
--delimiter //
56+
create procedure p1(in p_a varchar(1000)) insert into t1 values (p_a);//
57+
create procedure p2(in s varchar(10))
58+
begin
59+
if s = '1' then set @startDate = now(); end if;
60+
if s = '2' then set @startDate = '2025-05-23'; end if;
61+
call p1(concat(s, @startDate, ' and '));
62+
end;//
63+
--delimiter ;
64+
call p2('1');
65+
call p2('2');
66+
drop table t1;
67+
drop procedure p1;
68+
drop procedure p2;
69+
5070
--echo # End of 10.11 tests

sql/sql_parse.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,11 +3072,6 @@ static bool do_execute_sp(THD *thd, sp_head *sp)
30723072
ha_rows select_limit= thd->variables.select_limit;
30733073
thd->variables.select_limit= HA_POS_ERROR;
30743074

3075-
/*
3076-
Reset current_select as it may point to random data as a
3077-
result of previous parsing.
3078-
*/
3079-
thd->lex->current_select= NULL;
30803075
thd->lex->in_sum_func= 0; // For Item_field::fix_fields()
30813076

30823077
/*

0 commit comments

Comments
 (0)