Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e9507f0e
Commit
e9507f0e
authored
Jul 22, 2004
by
pem@mysql.comhem.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed BUG#4579: Execution of SP crashes server.
Sub-CALLs of procedures zapped thd->current_arena for good.
parent
ed32dbba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
6 deletions
+61
-6
mysql-test/r/sp.result
mysql-test/r/sp.result
+21
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+30
-0
sql/sp_head.cc
sql/sp_head.cc
+10
-6
No files found.
mysql-test/r/sp.result
View file @
e9507f0e
...
@@ -1387,6 +1387,27 @@ group_concat(v)
...
@@ -1387,6 +1387,27 @@ group_concat(v)
yz,yz
yz,yz
drop procedure bug3368|
drop procedure bug3368|
drop table t3|
drop table t3|
drop table if exists t3|
create table t3 (f1 int, f2 int);
insert into t3 values (1,1);
create procedure bug4579_1 ()
begin
declare sf1 int;
select f1 into sf1 from t3 where f1=1 and f2=1;
update t3 set f2 = f2 + 1 where f1=1 and f2=1;
call bug4579_2();
end|
create procedure bug4579_2 ()
begin
end|
call bug4579_1()|
call bug4579_1()|
Warnings:
call bug4579_1()|
Warnings:
drop procedure bug4579_1|
drop procedure bug4579_2|
drop table t3|
drop table if exists fac|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
create procedure ifac(n int unsigned)
...
...
mysql-test/t/sp.test
View file @
e9507f0e
...
@@ -1592,6 +1592,36 @@ call bug3368('yz')|
...
@@ -1592,6 +1592,36 @@ call bug3368('yz')|
drop
procedure
bug3368
|
drop
procedure
bug3368
|
drop
table
t3
|
drop
table
t3
|
#
# BUG#4579
#
--
disable_warnings
drop
table
if
exists
t3
|
--
enable_warnings
create
table
t3
(
f1
int
,
f2
int
);
insert
into
t3
values
(
1
,
1
);
create
procedure
bug4579_1
()
begin
declare
sf1
int
;
select
f1
into
sf1
from
t3
where
f1
=
1
and
f2
=
1
;
update
t3
set
f2
=
f2
+
1
where
f1
=
1
and
f2
=
1
;
call
bug4579_2
();
end
|
create
procedure
bug4579_2
()
begin
end
|
call
bug4579_1
()
|
call
bug4579_1
()
|
call
bug4579_1
()
|
drop
procedure
bug4579_1
|
drop
procedure
bug4579_2
|
drop
table
t3
|
#
#
# Some "real" examples
# Some "real" examples
...
...
sql/sp_head.cc
View file @
e9507f0e
...
@@ -377,9 +377,11 @@ sp_head::execute(THD *thd)
...
@@ -377,9 +377,11 @@ sp_head::execute(THD *thd)
DBUG_ENTER
(
"sp_head::execute"
);
DBUG_ENTER
(
"sp_head::execute"
);
char
olddb
[
128
];
char
olddb
[
128
];
bool
dbchanged
;
bool
dbchanged
;
sp_rcontext
*
ctx
=
thd
->
spcont
;
sp_rcontext
*
ctx
;
int
ret
=
0
;
int
ret
=
0
;
uint
ip
=
0
;
uint
ip
=
0
;
Item_arena
*
old_arena
;
#ifndef EMBEDDED_LIBRARY
#ifndef EMBEDDED_LIBRARY
if
(
check_stack_overrun
(
thd
,
olddb
))
if
(
check_stack_overrun
(
thd
,
olddb
))
...
@@ -392,10 +394,12 @@ sp_head::execute(THD *thd)
...
@@ -392,10 +394,12 @@ sp_head::execute(THD *thd)
if
((
ret
=
sp_use_new_db
(
thd
,
m_db
.
str
,
olddb
,
sizeof
(
olddb
),
0
,
&
dbchanged
)))
if
((
ret
=
sp_use_new_db
(
thd
,
m_db
.
str
,
olddb
,
sizeof
(
olddb
),
0
,
&
dbchanged
)))
goto
done
;
goto
done
;
if
(
ctx
)
if
(
(
ctx
=
thd
->
spcont
)
)
ctx
->
clear_handler
();
ctx
->
clear_handler
();
thd
->
query_error
=
0
;
thd
->
query_error
=
0
;
old_arena
=
thd
->
current_arena
;
thd
->
current_arena
=
this
;
thd
->
current_arena
=
this
;
do
do
{
{
sp_instr
*
i
;
sp_instr
*
i
;
...
@@ -433,14 +437,14 @@ sp_head::execute(THD *thd)
...
@@ -433,14 +437,14 @@ sp_head::execute(THD *thd)
}
while
(
ret
==
0
&&
!
thd
->
killed
&&
!
thd
->
query_error
&&
}
while
(
ret
==
0
&&
!
thd
->
killed
&&
!
thd
->
query_error
&&
!
thd
->
net
.
report_error
);
!
thd
->
net
.
report_error
);
if
(
thd
->
current_arena
)
cleanup_items
(
thd
->
current_arena
->
free_list
);
thd
->
current_arena
=
old_arena
;
done:
done:
DBUG_PRINT
(
"info"
,
(
"ret=%d killed=%d query_error=%d"
,
DBUG_PRINT
(
"info"
,
(
"ret=%d killed=%d query_error=%d"
,
ret
,
thd
->
killed
,
thd
->
query_error
));
ret
,
thd
->
killed
,
thd
->
query_error
));
if
(
thd
->
current_arena
)
cleanup_items
(
thd
->
current_arena
->
free_list
);
thd
->
current_arena
=
0
;
if
(
thd
->
killed
||
thd
->
query_error
||
thd
->
net
.
report_error
)
if
(
thd
->
killed
||
thd
->
query_error
||
thd
->
net
.
report_error
)
ret
=
-
1
;
ret
=
-
1
;
/* If the DB has changed, the pointer has changed too, but the
/* If the DB has changed, the pointer has changed too, but the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment