Skip to content

Commit adbbcc0

Browse files
committed
Fixed crash when IN predicate is delivered into aggregates/unions
1 parent 66f6030 commit adbbcc0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/jrd/RecordSourceNodes.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3723,7 +3723,11 @@ static void genDeliverUnmapped(CompilerScratch* csb,
37233723
children.add(cmpNode->arg2);
37243724
}
37253725
else if (listNode)
3726+
{
37263727
children.add(listNode->arg);
3728+
for (auto item : listNode->list->items)
3729+
children.add(item);
3730+
}
37273731
else if (missingNode)
37283732
children.add(missingNode->arg);
37293733
else
@@ -3766,7 +3770,7 @@ static void genDeliverUnmapped(CompilerScratch* csb,
37663770
newListNode->list = FB_NEW_POOL(pool) ValueListNode(pool, count);
37673771

37683772
newChildren.add(newListNode->arg.getAddress());
3769-
for (auto item : newListNode->list->items)
3773+
for (auto& item : newListNode->list->items)
37703774
newChildren.add(item.getAddress());
37713775

37723776
deliverNode = newListNode;
@@ -3819,7 +3823,17 @@ static void genDeliverUnmapped(CompilerScratch* csb,
38193823
}
38203824

38213825
if (okNode)
3822-
deliverStack.push(deliverNode.release());
3826+
{
3827+
const auto node = deliverNode.release();
3828+
3829+
if (const auto newListNode = nodeAs<InListBoolNode>(node))
3830+
{
3831+
newListNode->lookup = FB_NEW_POOL(pool)
3832+
LookupValueList(pool, newListNode->list, newListNode->impureOffset);
3833+
}
3834+
3835+
deliverStack.push(node);
3836+
}
38233837
}
38243838
}
38253839

0 commit comments

Comments
 (0)