Fix underflow initialization of default values

Initialization of queryWindowClause and queryOrderByLimit "memset" underflow these variables.
It's possible due to the invalid usage sizeof this part of the program cause buffer overflow and function return data corruption in future changes.
pull/3317/head
Khashayar Fereidani 2019-11-25 22:12:04 +03:30 committed by Marco Slot
parent 7f4d13b470
commit 86ef68a657
1 changed files with 4 additions and 4 deletions

View File

@ -2078,11 +2078,11 @@ WorkerExtendedOpNode(MultiExtendedOp *originalOpNode,
bool queryHasAggregates = TargetListHasAggragates(originalTargetEntryList); bool queryHasAggregates = TargetListHasAggragates(originalTargetEntryList);
/* initialize to default values */ /* initialize to default values */
memset(&queryTargetList, 0, sizeof(queryGroupClause)); memset(&queryTargetList, 0, sizeof(queryTargetList));
memset(&queryGroupClause, 0, sizeof(queryGroupClause)); memset(&queryGroupClause, 0, sizeof(queryGroupClause));
memset(&queryDistinctClause, 0, sizeof(queryGroupClause)); memset(&queryDistinctClause, 0, sizeof(queryDistinctClause));
memset(&queryWindowClause, 0, sizeof(queryGroupClause)); memset(&queryWindowClause, 0, sizeof(queryWindowClause));
memset(&queryOrderByLimit, 0, sizeof(queryGroupClause)); memset(&queryOrderByLimit, 0, sizeof(queryOrderByLimit));
/* calculate the next sort group index based on the original target list */ /* calculate the next sort group index based on the original target list */
Index nextSortGroupRefIndex = GetNextSortGroupRef(originalTargetEntryList); Index nextSortGroupRefIndex = GetNextSortGroupRef(originalTargetEntryList);