aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2022-02-09 10:54:28 +0900
committerNIIBE Yutaka <[email protected]>2022-02-09 10:54:28 +0900
commit90f41a1898e421c04080d35d7fea98ee18e74865 (patch)
tree0741f789f0688322ad3ef16033230adf5f43fd2a
parent6936f234220d12a87fe17f7fbdbb29ba9787dd95 (diff)
downloadlibgcrypt-90f41a1898e421c04080d35d7fea98ee18e74865.tar.gz
libgcrypt-90f41a1898e421c04080d35d7fea98ee18e74865.tar.bz2
libgcrypt-90f41a1898e421c04080d35d7fea98ee18e74865.zip
Fix memory allocation when GCRYCTL_ENABLE_M_GUARD.
* configure.ac: Add check for ALIGNOF_LONG_DOUBLE. * src/stdmem.c: Adjust EXTRA_ALIGN. -- GnuPG-bug-id: 5822 Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--configure.ac2
-rw-r--r--src/stdmem.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 41e3654d..0667484e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -363,6 +363,8 @@ AC_CHECK_SIZEOF(unsigned long, 4)
AC_CHECK_SIZEOF(unsigned long long, 0)
AC_CHECK_SIZEOF(void *, 0)
+AC_CHECK_ALIGNOF(long double)
+
AC_TYPE_UINTPTR_T
if test "$ac_cv_sizeof_unsigned_short" = "0" \
diff --git a/src/stdmem.c b/src/stdmem.c
index 04ce64fb..f657ddcc 100644
--- a/src/stdmem.c
+++ b/src/stdmem.c
@@ -61,7 +61,9 @@
#define MAGIC_SEC_BYTE 0xcc
#define MAGIC_END_BYTE 0xaa
-#if SIZEOF_UNSIGNED_LONG == 8
+#ifdef ALIGNOF_LONG_DOUBLE
+#define EXTRA_ALIGN (ALIGNOF_LONG_DOUBLE-4)
+#elif SIZEOF_UNSIGNED_LONG == 8
#define EXTRA_ALIGN 4
#else
#define EXTRA_ALIGN 0