Skip to content

Commit 7ba6ee8

Browse files
committed
Add missed bms_copy() in perform_pruning_combine_step
We were initializing a BMS to merely reference an existing one, which would cause a double-free (and a crash) when the recursive algorithm tried to intersect it with an empty one. Fix it by creating a copy at initialization time. Reported-by: sqlsmith (by way of Andreas Seltenreich) Author: Amit Langote Discussion: https://postgr.es/m/[email protected]
1 parent 2c19ea8 commit 7ba6ee8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/partitioning/partprune.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2923,7 +2923,8 @@ perform_pruning_combine_step(PartitionPruneContext *context,
29232923
if (firststep)
29242924
{
29252925
/* Copy step's result the first time. */
2926-
result->bound_offsets = step_result->bound_offsets;
2926+
result->bound_offsets =
2927+
bms_copy(step_result->bound_offsets);
29272928
result->scan_null = step_result->scan_null;
29282929
result->scan_default = step_result->scan_default;
29292930
firststep = false;

0 commit comments

Comments
 (0)