Skip to content

Commit a7db71e

Browse files
author
Amit Kapila
committed
Fix uninitialized slot array access during the upgrade.
Commit 29d0a77 introduced fetching slot information from the old cluster but didn't initialize the required array in all the code paths. So when trying to access the array in verbose mode for the new cluster, it leads to an uninitialized memory access. Author: Vignesh C Discussion: http://postgr.es/m/CALDaNm1tntGP5=CtMz=v+k3_PGv7kE9t6iWSgX-QiurAaFkhZw@mail.gmail.com
1 parent 108161b commit a7db71e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/bin/pg_upgrade/info.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ get_db_infos(ClusterInfo *cluster)
408408
i_spclocation = PQfnumber(res, "spclocation");
409409

410410
ntups = PQntuples(res);
411-
dbinfos = (DbInfo *) pg_malloc(sizeof(DbInfo) * ntups);
411+
dbinfos = (DbInfo *) pg_malloc0(sizeof(DbInfo) * ntups);
412412

413413
for (tupnum = 0; tupnum < ntups; tupnum++)
414414
{
@@ -636,15 +636,11 @@ get_old_cluster_logical_slot_infos(DbInfo *dbinfo, bool live_check)
636636
PGconn *conn;
637637
PGresult *res;
638638
LogicalSlotInfo *slotinfos = NULL;
639-
int num_slots = 0;
639+
int num_slots;
640640

641641
/* Logical slots can be migrated since PG17. */
642642
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 1600)
643-
{
644-
dbinfo->slot_arr.slots = slotinfos;
645-
dbinfo->slot_arr.nslots = num_slots;
646643
return;
647-
}
648644

649645
conn = connectToServer(&old_cluster, dbinfo->db_name);
650646

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