From dd3d9477b25b546407e18b4b474e766db1709aa7 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Thu, 14 Apr 2011 16:35:24 +0200 Subject: Bug#11765713 58705: OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES CREATED BY OPT_SUM_QU Valgrind warnings were caused by comparing index values to an un-initialized field. mysql-test/r/subselect.result: New test cases. mysql-test/t/subselect.test: New test cases. sql/opt_sum.cc: Add thd to opt_sum_query enabling it to test for errors. If we have a non-nullable index, we cannot use it to match null values, since set_null() will be ignored, and we might compare uninitialized data. sql/sql_select.cc: Add thd to opt_sum_query, enabling it to test for errors. sql/sql_select.h: Add thd to opt_sum_query, enabling it to test for errors. --- sql/sql_select.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql/sql_select.h') diff --git a/sql/sql_select.h b/sql/sql_select.h index 5350e28d8ff..dd810ae5156 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -612,7 +612,8 @@ Field* create_tmp_field_from_field(THD *thd, Field* org_field, /* functions from opt_sum.cc */ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order); -int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds); +int opt_sum_query(THD* thd, + TABLE_LIST *tables, List &all_fields, COND *conds); /* from sql_delete.cc, used by opt_range.cc */ extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b); -- cgit v1.2.1