Package: db / 5.1.29-9+deb8u1

005-pg_crypt_size.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- db-5.1.25.orig/src/dbinc/db_page.h
+++ db-5.1.25/src/dbinc/db_page.h
@@ -226,6 +226,17 @@ typedef struct __pg_crypto {
 	 */
 } PG_CRYPTO;
 
+/*
+ * With most compilers sizeof(PG_CRYPTO) == 38.  However some ABIs
+ * require it to be padded to 40 bytes.  The padding must be excluded
+ * from our size calculations due to the 16-byte alignment requirement
+ * for crypto.
+ *
+ * A similar problem applies to PG_CHKSUM, but it's too late to change
+ * that.
+ */
+#define SIZEOF_PG_CRYPTO 38
+
 typedef struct _db_page {
 	DB_LSN	  lsn;		/* 00-07: Log sequence number. */
 	db_pgno_t pgno;		/* 08-11: Current page number. */
@@ -261,7 +272,7 @@ typedef struct _db_page {
  */
 #define	P_INP(dbp, pg)							\
 	((db_indx_t *)((u_int8_t *)(pg) + SIZEOF_PAGE +			\
-	(F_ISSET((dbp), DB_AM_ENCRYPT) ? sizeof(PG_CRYPTO) :		\
+	(F_ISSET((dbp), DB_AM_ENCRYPT) ? SIZEOF_PG_CRYPTO :		\
 	(F_ISSET((dbp), DB_AM_CHKSUM) ? sizeof(PG_CHKSUM) : 0))))
 
 #define	P_IV(dbp, pg)							\