summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2013-06-26 19:55:15 -0400
committerNoah Misch <noah@leadboat.com>2013-06-26 19:55:15 -0400
commit1d96bb96024c51f5a445f85ec45ce2e9bbd08c56 (patch)
treeb375f205d615a4da74167a0f90b50f573693d5b2
parentd53f7cf11658a3252a6fddf308b992b751379f09 (diff)
Initialize pad bytes in GinFormTuple().
Every other core buffer page consumer initializes the bytes it furnishes to PageAddItem(). For consistency, do the same here. No back-patch; regardless, we couldn't count on the fix so long as binary upgrade can carry forward affected index builds.
-rw-r--r--src/backend/access/gin/ginentrypage.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c
index 8ead38f234a..7733028fba8 100644
--- a/src/backend/access/gin/ginentrypage.c
+++ b/src/backend/access/gin/ginentrypage.c
@@ -112,6 +112,12 @@ GinFormTuple(GinState *ginstate,
if (newsize != IndexTupleSize(itup))
{
itup = repalloc(itup, newsize);
+ /*
+ * PostgreSQL 9.3 and earlier did not clear this new space, so we
+ * might find uninitialized padding when reading tuples from disk.
+ */
+ memset((char *) itup + IndexTupleSize(itup),
+ 0, newsize - IndexTupleSize(itup));
/* set new size in tuple header */
itup->t_info &= ~INDEX_SIZE_MASK;