Skip to content

Commit 1d96bb9

Browse files
committed
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.
1 parent d53f7cf commit 1d96bb9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/backend/access/gin/ginentrypage.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ GinFormTuple(GinState *ginstate,
112112
if (newsize != IndexTupleSize(itup))
113113
{
114114
itup = repalloc(itup, newsize);
115+
/*
116+
* PostgreSQL 9.3 and earlier did not clear this new space, so we
117+
* might find uninitialized padding when reading tuples from disk.
118+
*/
119+
memset((char *) itup + IndexTupleSize(itup),
120+
0, newsize - IndexTupleSize(itup));
115121

116122
/* set new size in tuple header */
117123
itup->t_info &= ~INDEX_SIZE_MASK;

0 commit comments

Comments
 (0)