summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2020-06-01 13:10:46 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2020-06-01 13:21:05 -0700
commit5b4de52083512d1676b54666a701c931d04b866a (patch)
treec1bbddf0ea5dd14d0b236440a00edc443843a4d7 /include
parent5d68f9823e6a4198b8fec73b03c1d0125a2aa6a8 (diff)
downloadnasm-5b4de52083512d1676b54666a701c931d04b866a.tar.gz
BR 3392667: more reasonable limit for expression descent
Set an expression descent limit to 8192, which is more reasonable to expect to work on most platforms. Furthermore, if getrlimit() exists, then try to use it to see if we need to further limit the size. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'include')
-rw-r--r--include/compiler.h7
-rw-r--r--include/nasmlib.h5
2 files changed, 11 insertions, 1 deletions
diff --git a/include/compiler.h b/include/compiler.h
index 7c937988..43984338 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -360,6 +360,13 @@ static inline void *mempcpy(void *dst, const void *src, size_t n)
# endif
#endif
+/*
+ * If SIZE_MAX is not defined, rely on size_t being unsigned
+ */
+#ifndef SIZE_MAX
+# define SIZE_MAX (((size_t)0) - 1)
+#endif
+
/* Watcom doesn't handle switch statements with 64-bit types, hack around it */
#ifdef __WATCOMC__
# define BOGUS_CASE 0x76543210
diff --git a/include/nasmlib.h b/include/nasmlib.h
index c4b4ac4c..e9bfbccf 100644
--- a/include/nasmlib.h
+++ b/include/nasmlib.h
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2019 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2020 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -456,4 +456,7 @@ static inline int64_t const_func signed_bits(int64_t value, int bits)
/* check if value is power of 2 */
#define is_power2(v) ((v) && ((v) & ((v) - 1)) == 0)
+/* try to get the system stack size */
+extern size_t nasm_get_stack_size_limit(void);
+
#endif