git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 82bbb60)
Fix a second cause of undersized pallocs for btree_gist indexes on macaddr.
2014年5月16日 19:18:09 +0000 (15:18 -0400)
2014年5月16日 19:18:09 +0000 (15:18 -0400)
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.


diff --git a/contrib/btree_gist/btree_macaddr.c b/contrib/btree_gist/btree_macaddr.c
index 244b95154bb7b7e137420755071d505a5c4653c4..ed58a1b7429b31493c8466ab31db87ef648477c0 100644 (file)
--- a/contrib/btree_gist/btree_macaddr.c
+++ b/contrib/btree_gist/btree_macaddr.c
@@ -12,6 +12,7 @@ typedef struct
{
macaddr lower;
macaddr upper;
+ char pad[4]; /* make struct size = sizeof(gbtreekey16) */
} macKEY;
/*
@@ -143,7 +144,7 @@ Datum
gbt_macad_union(PG_FUNCTION_ARGS)
{
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
- void *out = palloc(sizeof(macKEY));
+ void *out = palloc0(sizeof(macKEY));
*(int *) PG_GETARG_POINTER(1) = sizeof(macKEY);
PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo));
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /