Skip to content

Commit 4eadf2d

Browse files
committed
More autosize structure error checks.
1 parent 37e8621 commit 4eadf2d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/storage/buffer/buf_init.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.5 1997/01/23 18:14:40 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.6 1997/01/25 21:01:16 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -136,7 +136,10 @@ InitBufferPool(IPCKey key)
136136
int i;
137137

138138
/* check padding of BufferDesc and BufferHdr */
139-
if (sizeof(struct sbufdesc) != PADDED_SBUFDESC_SIZE)
139+
/* we need both checks because a sbufdesc_padded > PADDED_SBUFDESC_SIZE
140+
will shrink sbufdesc to the required size, which is bad */
141+
if (sizeof(struct sbufdesc) != PADDED_SBUFDESC_SIZE ||
142+
sizeof(struct sbufdesc_padded) > PADDED_SBUFDESC_SIZE)
140143
elog(WARN,"Internal error: sbufdesc does not have the proper size, "
141144
"contact the Postgres developers");
142145
if (sizeof(struct sbufdesc_unpadded) <= PADDED_SBUFDESC_SIZE/2)

0 commit comments

Comments
 (0)