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
cd1d161c
Commit
cd1d161c
authored
May 30, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19637 Crash on an SP variable assignment to a wrong subselect
parent
f98bb231
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
1 deletion
+96
-1
mysql-test/main/sp.result
mysql-test/main/sp.result
+15
-0
mysql-test/main/sp.test
mysql-test/main/sp.test
+23
-0
mysql-test/suite/compat/oracle/r/sp.result
mysql-test/suite/compat/oracle/r/sp.result
+16
-0
mysql-test/suite/compat/oracle/t/sp.test
mysql-test/suite/compat/oracle/t/sp.test
+25
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+17
-1
No files found.
mysql-test/main/sp.result
View file @
cd1d161c
...
...
@@ -8792,3 +8792,18 @@ drop procedure p4;
drop table t1;
set @@sql_mode=@save_sql_mode;
# End of 10.3 tests
#
# Start of 10.4 tests
#
#
# MDEV-19637 Crash on an SP variable assignment to a wrong subselect
#
BEGIN NOT ATOMIC
DECLARE a INT;
SET a=(SELECT 1 FROM DUAL UNION SELECT HIGH_PRIORITY 2 FROM DUAL);
END;
$$
ERROR 42000: Incorrect usage/placement of 'HIGH_PRIORITY'
#
# End of 10.4 tests
#
mysql-test/main/sp.test
View file @
cd1d161c
...
...
@@ -10323,3 +10323,26 @@ drop table t1;
set
@@
sql_mode
=@
save_sql_mode
;
--
echo
# End of 10.3 tests
--
echo
#
--
echo
# Start of 10.4 tests
--
echo
#
--
echo
#
--
echo
# MDEV-19637 Crash on an SP variable assignment to a wrong subselect
--
echo
#
DELIMITER
$$
;
--
error
ER_CANT_USE_OPTION_HERE
BEGIN
NOT
ATOMIC
DECLARE
a
INT
;
SET
a
=
(
SELECT
1
FROM
DUAL
UNION
SELECT
HIGH_PRIORITY
2
FROM
DUAL
);
END
;
$$
DELIMITER
;
$$
--
echo
#
--
echo
# End of 10.4 tests
--
echo
#
mysql-test/suite/compat/oracle/r/sp.result
View file @
cd1d161c
...
...
@@ -2552,3 +2552,19 @@ idx
idx
1
DROP PROCEDURE p1;
#
# Start of 10.4 tests
#
#
# MDEV-19637 Crash on an SP variable assignment to a wrong subselect
#
DECLARE
a INT;
BEGIN
SET a=(SELECT 1 FROM DUAL UNION SELECT HIGH_PRIORITY 2 FROM DUAL);
END;
$$
ERROR 42000: Incorrect usage/placement of 'HIGH_PRIORITY'
#
# End of 10.4 tests
#
mysql-test/suite/compat/oracle/t/sp.test
View file @
cd1d161c
...
...
@@ -2387,3 +2387,28 @@ $$
DELIMITER
;
$$
CALL
p1
();
DROP
PROCEDURE
p1
;
--
echo
#
--
echo
# Start of 10.4 tests
--
echo
#
--
echo
#
--
echo
# MDEV-19637 Crash on an SP variable assignment to a wrong subselect
--
echo
#
DELIMITER
$$
;
--
error
ER_CANT_USE_OPTION_HERE
DECLARE
a
INT
;
BEGIN
SET
a
=
(
SELECT
1
FROM
DUAL
UNION
SELECT
HIGH_PRIORITY
2
FROM
DUAL
);
END
;
$$
DELIMITER
;
$$
--
echo
#
--
echo
# End of 10.4 tests
--
echo
#
sql/sql_yacc.yy
View file @
cd1d161c
...
...
@@ -575,8 +575,24 @@ bool sp_create_assignment_instr(THD *thd, bool no_lookahead)
return true;
}
lex->pop_select();
if (Lex->check_main_unit_semantics())
if (lex->check_main_unit_semantics())
{
/*
"lex" can be referrenced by:
- sp_instr_set SET a= expr;
- sp_instr_set_row_field SET r.a= expr;
- sp_instr_stmt (just generated above) SET @a= expr;
In this case, "lex" is fully owned by sp_instr_xxx and it will
be deleted by the destructor ~sp_instr_xxx().
So we should remove "lex" from the stack sp_head::m_lex,
to avoid double free.
Note, in case "lex" is not owned by any sp_instr_xxx,
it's also safe to remove it from the stack right now.
So we can remove it unconditionally, without testing lex->sp_lex_in_use.
*/
lex->sphead->restore_lex(thd);
return true;
}
enum_var_type inner_option_type= lex->option_type;
if (lex->sphead->restore_lex(thd))
return true;
...
...
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