diff options
author | unknown <cmiller@maint1.mysql.com> | 2006-08-15 18:41:21 +0200 |
---|---|---|
committer | unknown <cmiller@maint1.mysql.com> | 2006-08-15 18:41:21 +0200 |
commit | e0bffad3e8c121d81e1e64682d7fc8bc5aad8fcf (patch) | |
tree | 3c68981f31652387f476c382903a11ee5922f955 /sql/sql_lex.cc | |
parent | 75e40b161b5cbbea28eca2641e6dfadaf09267a1 (diff) | |
download | mariadb-git-e0bffad3e8c121d81e1e64682d7fc8bc5aad8fcf.tar.gz |
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.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7d4dca15608..479db7b5b99 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1042,6 +1042,8 @@ int MYSQLlex(void *arg, void *yythd) if (c == '.') lex->next_state=MY_LEX_IDENT_SEP; length= (uint) (lex->ptr - lex->tok_start)-1; + if (length == 0) + return(ABORT_SYM); // Names must be nonempty. if ((tokval= find_keyword(lex,length,0))) { yyUnget(); // Put back 'c' |