1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Bug #19892803: ASSERTION FAILED: N < M_SIZE WITH DISTINCT TIME

ISSUE:
------
We pre-allocate the ref_pointer_array before we resolve outer
references. This means that in some cases the
ref_pointer_array may not be large enough to hold all
references created. One such case is aggregate functions in
having clause of a subquery which may add items to select list
of outer query. So it is necessary to consider
select_n_having_items for subqueries while allocating
ref_pointer_array else we will get buffer overflow.

SOLUTION:
---------
Allocate a larger ref_pointer_array by aggregating
select_n_having_items for subqueries.
The fix in sql_yacc.yy is a backport from bug fix 18782905.
This commit is contained in:
Mithun C Y
2015-01-30 16:36:23 +05:30
parent 08526dfb01
commit c9f7948bc4

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -14128,6 +14128,13 @@ subselect_end:
*/ */
lex->current_select->select_n_where_fields+= lex->current_select->select_n_where_fields+=
child->select_n_where_fields; child->select_n_where_fields;
/*
Aggregate functions in having clause may add fields to an outer
select. Count them also.
*/
lex->current_select->select_n_having_items+=
child->select_n_having_items;
} }
; ;