about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-01 20:11:32 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-01 20:11:32 +0100
commitd2c4e60115b263991540cf9707bb55e47e135adb (patch)
treed9145ae34a60fef1704b7fcc0edf015cc718b521
parent2b50f6e0f8ecd12f62900f1209a6bc5881952e67 (diff)
downloadafl++-d2c4e60115b263991540cf9707bb55e47e135adb.tar.gz
align to max_align_t
-rw-r--r--libdislocator/libdislocator.so.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c
index 480d2fc6..21cd6f43 100644
--- a/libdislocator/libdislocator.so.c
+++ b/libdislocator/libdislocator.so.c
@@ -20,8 +20,10 @@
 
  */
 
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
 #include <limits.h>
 #include <errno.h>
@@ -62,7 +64,12 @@
 #include "config.h"
 #include "types.h"
 
-#define ALLOC_ALIGN_SIZE (sizeof(void*))
+#if __STDC_VERSION__ < 201112L
+// use this hack if not C11
+typedef struct { long long __ll; long double __ld; } max_align_t;
+#endif
+
+#define ALLOC_ALIGN_SIZE (_Alignof(max_align_t))
 
 #ifndef PAGE_SIZE
 #define PAGE_SIZE 4096