From 53bb6a47cd67fb988c5cf6f1fff48b5a5023bcd1 Mon Sep 17 00:00:00 2001 From: "cmiller@maint1.mysql.com" <> Date: Tue, 15 Aug 2006 18:41:21 +0200 Subject: 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. --- sql/gen_lex_hash.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'sql/gen_lex_hash.cc') diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 7e0b178f7af..e59986092e4 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -442,13 +442,16 @@ int main(int argc,char **argv) if (get_options(argc,(char **) argv)) exit(1); + /* Broken up to indicate that it's not advice to you, gentle reader. */ + printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); + printf("/* Copyright (C) 2001-2004 MySQL AB\n\ This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ and you are welcome to modify and redistribute it under the GPL license\n\ \n*/\n\n"); - printf("/* This code is generated by gen_lex_hash.cc that seeks for\ - a perfect\nhash function */\n\n"); + printf("/* Do " "not " "edit " "this " "file! This is generated by " + "gen_lex_hash.cc\nthat seeks for a perfect hash function */\n\n"); printf("#include \"lex.h\"\n\n"); calc_length(); @@ -468,6 +471,12 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\ {\n\ register uchar *hash_map;\n\ register const char *cur_str= s;\n\ +\n\ + if (len == 0) {\n\ + DBUG_PRINT(\"warning\", (\"get_hash_symbol() received a request for a zero-length symbol, which is probably a mistake.\"));\ + return(NULL);\n\ + }\ +\n\ if (function){\n\ if (len>sql_functions_max_len) return 0;\n\ hash_map= sql_functions_map;\n\ -- cgit v1.2.1