mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #20908: Crash if select @@""
Zero-length variables caused failures when using the length to look up the name in a hash. Instead, signal that no zero-length name can ever be found and that to encounter one is a syntax error. mysql-test/r/variables.result: Results for test. mysql-test/t/variables.test: Insert tests to prove that zero-length variable names do not cause faults. sql/gen_lex_hash.cc: If the length is zero, then there is nothing to look-up in the hash. sql/sql_lex.cc: Names of variables must not be empty. Signal an error of that happens.
This commit is contained in:
@ -689,6 +689,12 @@ select @@log_queries_not_using_indexes;
|
||||
show variables like 'log_queries_not_using_indexes';
|
||||
Variable_name Value
|
||||
log_queries_not_using_indexes OFF
|
||||
select @@"";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '""' at line 1
|
||||
select @@&;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&' at line 1
|
||||
select @@@;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@' at line 1
|
||||
End of 5.0 tests
|
||||
set global binlog_cache_size =@my_binlog_cache_size;
|
||||
set global connect_timeout =@my_connect_timeout;
|
||||
|
@ -585,6 +585,16 @@ show variables like 'ssl%';
|
||||
select @@log_queries_not_using_indexes;
|
||||
show variables like 'log_queries_not_using_indexes';
|
||||
|
||||
#
|
||||
# Bug#20908: Crash if select @@""
|
||||
#
|
||||
--error ER_PARSE_ERROR
|
||||
select @@"";
|
||||
--error ER_PARSE_ERROR
|
||||
select @@&;
|
||||
--error ER_PARSE_ERROR
|
||||
select @@@;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# This is at the very after the versioned tests, since it involves doing
|
||||
@ -620,3 +630,4 @@ set global server_id =@my_server_id;
|
||||
set global slow_launch_time =@my_slow_launch_time;
|
||||
set global storage_engine =@my_storage_engine;
|
||||
set global thread_cache_size =@my_thread_cache_size;
|
||||
|
||||
|
Reference in New Issue
Block a user