Skip to content

Commit 587272e

Browse files
author
Kailasnath Nagarkar
committed
Bug #24659861: HANDLE_FATAL_SIGNAL (SIG=11) IN
SUBSELECT_HASH_SJ_ENGINE::CLEANUP ISSUE: For processing the query, creation of myisam temporary table fails since the key length in the query is larger than the supported length. Further in cleanup, variables which are not allocated due to the above reason are attempted to free up resulting in server to exit abnormally. FIX: Server will return error if unable to create temporary table for query processing. Added checks in cleanup to check if variables are actually allocated before freeing up.
1 parent f57ac3a commit 587272e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

sql/item_subselect.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights
1+
/* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights
22
reserved.
33
44
This program is free software; you can redistribute it and/or modify
@@ -3565,6 +3565,7 @@ bool subselect_hash_sj_engine::setup(List<Item> *tmp_columns)
35653565
free_tmp_table(thd, tmp_table);
35663566
delete result;
35673567
result= NULL;
3568+
thd->raise_error_printf(ER_INTERNAL_ERROR, "Failed to create MyISAM temporary table for query processing, key too large");
35683569
DBUG_RETURN(TRUE);
35693570
}
35703571
result= tmp_result_sink;
@@ -3723,12 +3724,15 @@ void subselect_hash_sj_engine::cleanup()
37233724
{
37243725
DBUG_ENTER("subselect_hash_sj_engine::cleanup");
37253726
is_materialized= false;
3726-
result->cleanup(); /* Resets the temp table as well. */
3727+
3728+
if (result)
3729+
result->cleanup(); /* Resets the temp table as well. */
37273730
THD * const thd= item->unit->thd;
37283731
DEBUG_SYNC(thd, "before_index_end_in_subselect");
3729-
if (tab->table->file->inited)
3732+
if (tab && tab->table->file->inited)
37303733
tab->table->file->ha_index_end(); // Close the scan over the index
3731-
free_tmp_table(thd, tab->table);
3734+
if (tab)
3735+
free_tmp_table(thd, tab->table);
37323736
tab= NULL;
37333737
materialize_engine->cleanup();
37343738
DBUG_VOID_RETURN;

0 commit comments

Comments
 (0)