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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
95d56d0e
Commit
95d56d0e
authored
Jan 09, 2012
by
Jon Olav Hauglid
Browse files
Options
Browse Files
Download
Plain Diff
Merge from mysql-5.1-security to mysql-5.5-security
Text conflict in sql/sql_yacc.yy
parents
9208e8d7
a66b452d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
4 deletions
+89
-4
mysql-test/r/sp.result
mysql-test/r/sp.result
+23
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+29
-0
sql/sp_head.cc
sql/sp_head.cc
+17
-0
sql/sp_head.h
sql/sp_head.h
+11
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+9
-3
No files found.
mysql-test/r/sp.result
View file @
95d56d0e
...
...
@@ -7745,3 +7745,26 @@ DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP TABLE t1;
# End of 5.5 test
#
# Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
#
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INT
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f1();
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f1();
RETURN f1();
END;
END;
RETURN 1;
END $
SELECT f1();
f1()
1
Warnings:
Error 1424 Recursive stored functions and triggers are not allowed.
Error 1305 FUNCTION test.f1 does not exist
DROP FUNCTION f1;
mysql-test/t/sp.test
View file @
95d56d0e
...
...
@@ -9036,3 +9036,32 @@ DROP PROCEDURE p2;
DROP
TABLE
t1
;
--
echo
# End of 5.5 test
--
echo
#
--
echo
# Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
--
echo
#
--
disable_warnings
DROP
FUNCTION
IF
EXISTS
f1
;
--
enable_warnings
delimiter
$
;
CREATE
FUNCTION
f1
()
RETURNS
INT
BEGIN
DECLARE
CONTINUE
HANDLER
FOR
SQLEXCEPTION
BEGIN
END
;
BEGIN
DECLARE
CONTINUE
HANDLER
FOR
SQLEXCEPTION
RETURN
f1
();
BEGIN
DECLARE
CONTINUE
HANDLER
FOR
SQLEXCEPTION
RETURN
f1
();
RETURN
f1
();
END
;
END
;
RETURN
1
;
END
$
delimiter
;
$
# This used to cause an assertion.
SELECT
f1
();
DROP
FUNCTION
f1
;
sql/sp_head.cc
View file @
95d56d0e
...
...
@@ -3559,6 +3559,23 @@ sp_instr_hpush_jump::opt_mark(sp_head *sp, List<sp_instr> *leads)
m_optdest
=
sp
->
get_instr
(
m_dest
);
}
sp
->
add_mark_lead
(
m_dest
,
leads
);
/*
For continue handlers, all instructions in the scope of the handler
are possible leads. For example, the instruction after freturn might
be executed if the freturn triggers the condition handled by the
continue handler.
m_dest marks the start of the handler scope. It's added as a lead
above, so we start on m_dest+1 here.
m_opt_hpop is the hpop marking the end of the handler scope.
*/
if
(
m_type
==
SP_HANDLER_CONTINUE
)
{
for
(
uint
scope_ip
=
m_dest
+
1
;
scope_ip
<=
m_opt_hpop
;
scope_ip
++
)
sp
->
add_mark_lead
(
scope_ip
,
leads
);
}
return
m_ip
+
1
;
}
...
...
sql/sp_head.h
View file @
95d56d0e
...
...
@@ -1023,7 +1023,7 @@ class sp_instr_hpush_jump : public sp_instr_jump
public:
sp_instr_hpush_jump
(
uint
ip
,
sp_pcontext
*
ctx
,
int
htype
,
uint
fp
)
:
sp_instr_jump
(
ip
,
ctx
),
m_type
(
htype
),
m_frame
(
fp
)
:
sp_instr_jump
(
ip
,
ctx
),
m_type
(
htype
),
m_frame
(
fp
)
,
m_opt_hpop
(
0
)
{
m_cond
.
empty
();
}
...
...
@@ -1045,6 +1045,15 @@ class sp_instr_hpush_jump : public sp_instr_jump
return
m_ip
;
}
virtual
void
backpatch
(
uint
dest
,
sp_pcontext
*
dst_ctx
)
{
DBUG_ASSERT
(
!
m_dest
||
!
m_opt_hpop
);
if
(
!
m_dest
)
m_dest
=
dest
;
else
m_opt_hpop
=
dest
;
}
inline
void
add_condition
(
struct
sp_cond_type
*
cond
)
{
m_cond
.
push_front
(
cond
);
...
...
@@ -1054,6 +1063,7 @@ class sp_instr_hpush_jump : public sp_instr_jump
int
m_type
;
///< Handler type
uint
m_frame
;
uint
m_opt_hpop
;
// hpop marking end of handler scope.
List
<
struct
sp_cond_type
>
m_cond
;
};
// class sp_instr_hpush_jump : public sp_instr_jump
...
...
sql/sql_yacc.yy
View file @
95d56d0e
...
...
@@ -2739,9 +2739,15 @@ sp_decl:
sp_instr_hpush_jump *i=
new sp_instr_hpush_jump(sp->instructions(), ctx, $2,
ctx->current_var_count());
if (i == NULL ||
sp->add_instr(i) ||
sp->push_backpatch(i, ctx->push_label((char *)"", 0)))
if (i == NULL || sp->add_instr(i))
MYSQL_YYABORT;
/* For continue handlers, mark end of handler scope. */
if ($2 == SP_HANDLER_CONTINUE &&
sp->push_backpatch(i, ctx->last_label()))
MYSQL_YYABORT;
if (sp->push_backpatch(i, ctx->push_label(empty_c_string, 0)))
MYSQL_YYABORT;
}
sp_hcond_list sp_proc_stmt
...
...
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