summaryrefslogtreecommitdiff
path: root/test/underflow.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/underflow.c')
-rw-r--r--test/underflow.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/underflow.c b/test/underflow.c
new file mode 100644
index 0000000..f23aa6d
--- /dev/null
+++ b/test/underflow.c
@@ -0,0 +1,13 @@
+#define _POSIX_C_SOURCE 200809L
+#include <stdio.h>
+#include <unistd.h>
+#include "mapalloc.h"
+
+int main(void)
+{
+ char *ptr = map_malloc(1);
+ long pagesize = sysconf(_SC_PAGESIZE);
+ printf("ptr: %p, pagesize %ld\n", ptr, pagesize);
+ ptr[-1] = '\0';
+ printf("shouldn't get here\n");
+}