Skip to content

Commit 8f68671

Browse files
committed
[PGPRO-3725] zero out garbage in append_rel_array if we allocate it.
Since 1d9056f563f3 (who uses AppendRelInfo* existence as a mark this rel is child) in 11.7 this led to (known) random segfaults.
1 parent fa068e7 commit 8f68671

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/hooks.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,13 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
498498
irange_len * sizeof(RangeTblEntry *));
499499

500500
#if PG_VERSION_NUM >= 110000
501-
/* Make sure append_rel_array is wide enough */
501+
/*
502+
* Make sure append_rel_array is wide enough; if it hasn't been
503+
* allocated previously, care to zero out [0; current_len) part.
504+
*/
502505
if (root->append_rel_array == NULL)
503-
root->append_rel_array = (AppendRelInfo **) palloc0(0);
506+
root->append_rel_array = (AppendRelInfo **)
507+
palloc0(current_len * sizeof(AppendRelInfo *));
504508
root->append_rel_array = (AppendRelInfo **)
505509
repalloc(root->append_rel_array,
506510
new_len * sizeof(AppendRelInfo *));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy