Commit 97c429f6 authored by Ramil Kalimullin's avatar Ramil Kalimullin

BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN GEOMETRY FUNCTION ARGUMENTS

A defect in the subquery substitution code may lead to a server crash:
setting substitution's name should be followed by setting its length
(to keep them in sync).
parent 44d88da5
...@@ -1081,4 +1081,10 @@ DROP TABLE t0, t1, t2; ...@@ -1081,4 +1081,10 @@ DROP TABLE t0, t1, t2;
SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))) ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
NULL NULL
#
# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
# GEOMETRY FUNCTION ARGUMENTS
#
SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
ERROR 22007: Illegal non geometric '' value found during parsing
End of 5.1 tests End of 5.1 tests
...@@ -818,5 +818,12 @@ DROP TABLE t0, t1, t2; ...@@ -818,5 +818,12 @@ DROP TABLE t0, t1, t2;
--echo # --echo #
SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
--echo #
--echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
--echo # GEOMETRY FUNCTION ARGUMENTS
--echo #
--error ER_ILLEGAL_VALUE_FOR_TYPE
SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -173,6 +173,7 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref) ...@@ -173,6 +173,7 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref)
(*ref)= substitution; (*ref)= substitution;
substitution->name= name; substitution->name= name;
substitution->name_length= name_length;
if (have_to_be_excluded) if (have_to_be_excluded)
engine->exclude(); engine->exclude();
substitution= 0; substitution= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment