From: Date: January 11 2006 9:39pm Subject: bk commit into 5.0 tree (evgen:1.1984) BUG#15538 List-Archive: http://lists.mysql.com/commits/937 X-Bug: 15538 Message-Id: <20060111203914.D19A922E3E4@moonbone.moonbone.local> Below is the list of changes that have just been committed into a local 5.0 repository of evgen. When evgen does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1984 06/01/11 23:39:09 evgen@stripped +3 -0 Fixed bug #15538: unchecked table absence caused server crash. Absence of table in left part of LEFT/RIGHT join wasn't checked before name resolution which resulted in NULL dereferencing and server crash. Modified rules: "table_ref LEFT opt_outer JOIN_SYM table_ref" and "table_ref RIGHT opt_outer JOIN_SYM table_ref" NULL check is moved before push_new_name_resolution_context() mysql-test/t/select.test 1.95 06/01/11 23:37:50 evgen@stripped +6 -0 Added test case for bug #15538: unchecked table absence caused server crash. mysql-test/r/select.result 1.116 06/01/11 23:37:18 evgen@stripped +2 -0 Added test case for bug #15538: unchecked table absence caused server crash. sql/sql_yacc.yy 1.446 06/01/11 23:36:13 evgen@stripped +2 -2 Fixed bug #15538: unchecked table absence caused server crash. Modified rules: "table_ref LEFT opt_outer JOIN_SYM table_ref" and "table_ref RIGHT opt_outer JOIN_SYM table_ref" NULL check is moved before push_new_name_resolution_context() # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: evgen # Host: moonbone.local # Root: /work/15538-bug-5.0-mysql --- 1.445/sql/sql_yacc.yy 2005-12-11 10:30:53 +03:00 +++ 1.446/sql/sql_yacc.yy 2006-01-11 23:36:13 +03:00 @@ -5248,13 +5248,13 @@ | table_ref LEFT opt_outer JOIN_SYM table_ref ON { + YYERROR_UNLESS($1 && $5); /* Change the current name resolution context to a local context. */ if (push_new_name_resolution_context(YYTHD, $1, $5)) YYABORT; } expr { - YYERROR_UNLESS($1 && $5); add_join_on($5,$8); Lex->pop_context(); $5->outer_join|=JOIN_TYPE_LEFT; @@ -5279,6 +5279,7 @@ | table_ref RIGHT opt_outer JOIN_SYM table_ref ON { + YYERROR_UNLESS($1 && $5); /* Change the current name resolution context to a local context. */ if (push_new_name_resolution_context(YYTHD, $1, $5)) YYABORT; @@ -5286,7 +5287,6 @@ expr { LEX *lex= Lex; - YYERROR_UNLESS($1 && $5); if (!($$= lex->current_select->convert_right_join())) YYABORT; add_join_on($$, $8); --- 1.115/mysql-test/r/select.result 2005-12-09 23:01:41 +03:00 +++ 1.116/mysql-test/r/select.result 2006-01-11 23:37:18 +03:00 @@ -3345,3 +3345,5 @@ f1 f2 f2 NULL a NULL drop table t1,t2; +select * from (select * left join t on f1=f2) tt; +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 'on f1=f2) tt' at line 1 --- 1.94/mysql-test/t/select.test 2005-12-09 23:01:28 +03:00 +++ 1.95/mysql-test/t/select.test 2006-01-11 23:37:50 +03:00 @@ -2815,3 +2815,9 @@ insert into t2 values('b'); select * from t1 left join t2 on f1=t2.f2 where t1.f2='a'; drop table t1,t2; + +# +# Bug#15538 unchecked table absense caused server crash. +# +--error 1064 +select * from (select * left join t on f1=f2) tt;