Skip to content

Commit 39586bc

Browse files
committed
Fix a second cause of undersized pallocs for btree_gist indexes on macaddr.
gbt_macad_union also allocated 12-byte structs where we really need 16. Per report from Andres Freund. No back-patch since there's no current risk of a real problem.
1 parent 82bbb60 commit 39586bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/btree_gist/btree_macaddr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ typedef struct
1212
{
1313
macaddr lower;
1414
macaddr upper;
15+
char pad[4]; /* make struct size = sizeof(gbtreekey16) */
1516
} macKEY;
1617

1718
/*
@@ -143,7 +144,7 @@ Datum
143144
gbt_macad_union(PG_FUNCTION_ARGS)
144145
{
145146
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
146-
void *out = palloc(sizeof(macKEY));
147+
void *out = palloc0(sizeof(macKEY));
147148

148149
*(int *) PG_GETARG_POINTER(1) = sizeof(macKEY);
149150
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));

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