aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-04-15 04:37:55 +0000
committerErlang/OTP <[email protected]>2010-04-15 04:37:55 +0000
commitab47252a5f7d540d4119d38dffe69acca86d2a41 (patch)
tree9817bba0553bcd409c36fb330f7408ec7ca2369c /erts
parent4e315422de9bb1b5c8d6668cbccf8fe1084f536c (diff)
parentf43718785523cb4635d1c22a78a7620ed5e86609 (diff)
downloadotp-ab47252a5f7d540d4119d38dffe69acca86d2a41.tar.gz
otp-ab47252a5f7d540d4119d38dffe69acca86d2a41.tar.bz2
otp-ab47252a5f7d540d4119d38dffe69acca86d2a41.zip
Merge branch 'ms/pcre-compile-workspace-overrun' into dev
* ms/pcre-compile-workspace-overrun: re_SUITE: Add pcre_compile_workspace_overflow/1 MacOS X: Boost default stack size Fix check for compile workspace overflow OTP-8539 ms/pcre-compile-workspace-overrun
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_init.c8
-rw-r--r--erts/emulator/pcre/pcre_compile.c9
2 files changed, 14 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index e97ab328cd..41cfcd74aa 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -819,7 +819,13 @@ erl_start(int argc, char **argv)
if (erts_sys_getenv("ERL_THREAD_POOL_SIZE", envbuf, &envbufsz) == 0) {
async_max_threads = atoi(envbuf);
}
-
+
+#if (defined(__APPLE__) && defined(__MACH__)) || defined(__DARWIN__)
+ /*
+ * The default stack size on MacOS X is too small for pcre.
+ */
+ erts_sched_thread_suggested_stack_size = 256;
+#endif
#ifdef DEBUG
verbose = DEBUG_DEFAULT;
diff --git a/erts/emulator/pcre/pcre_compile.c b/erts/emulator/pcre/pcre_compile.c
index 29743362d4..9508c5a697 100644
--- a/erts/emulator/pcre/pcre_compile.c
+++ b/erts/emulator/pcre/pcre_compile.c
@@ -92,6 +92,11 @@ is 4 there is plenty of room. */
#define COMPILE_WORK_SIZE (4096)
+/* The overrun tests check for a slightly smaller size so that they detect the
+overrun before it actually does run off the end of the data block. */
+
+#define WORK_SIZE_CHECK (COMPILE_WORK_SIZE - 100)
+
/* Table for handling escaped characters in the range '0'-'z'. Positive returns
are simple data values; negative values are for special things like \d and so
@@ -2445,7 +2450,7 @@ for (;; ptr++)
#ifdef DEBUG
if (code > cd->hwm) cd->hwm = code; /* High water info */
#endif
- if (code > cd->start_workspace + COMPILE_WORK_SIZE) /* Check for overrun */
+ if (code > cd->start_workspace + WORK_SIZE_CHECK) /* Check for overrun */
{
*errorcodeptr = ERR52;
goto FAILED;
@@ -2494,7 +2499,7 @@ for (;; ptr++)
/* In the real compile phase, just check the workspace used by the forward
reference list. */
- else if (cd->hwm > cd->start_workspace + COMPILE_WORK_SIZE)
+ else if (cd->hwm > cd->start_workspace + WORK_SIZE_CHECK)
{
*errorcodeptr = ERR52;
goto FAILED;