summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-07-15 11:56:12 +0000
committerMoonchild <moonchild@palemoon.org>2022-07-15 11:56:12 +0000
commit00f22ddbe62f9ab4cf314b1beb18b7f9a91edae2 (patch)
tree2ed6de1442ac798d57e8c925610ec7c05e0bf835 /config
parent08c90e00b92c52216eb9a78f5d34fda72b92465e (diff)
downloaduxp-00f22ddbe62f9ab4cf314b1beb18b7f9a91edae2.tar.gz
Issue #1805 - Improve stack size limits for all targets.
This allows us to use a greater rendering depth for exceedingly-deep DOM trees in layout, better matching what mainstream browsers are capable of. Note that for 32-bit Windows the stack size MUST be set to larger than the default or Bad Things Will Happen™ - we use 1.5 MB for this as a carefully-tuned value. This needs to be capped specifically for JS use because some JavaScript obfuscators deliberately trigger stack overflows and would lock up the browser otherwise as long as there's still stack space to abuse. For web compatibility we therefore limit this to 2MB in JS only (3x for ASAN) while still allowing a greater depth for the layout engine.
Diffstat (limited to 'config')
-rw-r--r--config/config.mk16
1 files changed, 14 insertions, 2 deletions
diff --git a/config/config.mk b/config/config.mk
index b71e65fc35..2d1ff365b1 100644
--- a/config/config.mk
+++ b/config/config.mk
@@ -377,8 +377,20 @@ endif # WINNT
ifdef _MSC_VER
ifeq ($(CPU_ARCH),x86_64)
-# set stack to 2MB on x64 build. See bug 582910
-WIN32_EXE_LDFLAGS += -STACK:2097152
+# Normal operation on 64-bit Windows needs 2 MB of stack. (Bug 582910)
+# ASAN requires 6 MB of stack.
+# Setting the stack to 8 MB to match the capability of other systems
+# to deal with frame construction for unreasonably deep DOM trees
+# with worst-case styling. This uses address space unnecessarily for
+# non-main threads, but that should be tolerable on 64-bit systems.
+WIN32_EXE_LDFLAGS += -STACK:8388608
+else
+# Since this setting affects the default stack size for non-main
+# threads, too, to avoid burning the address space, increase only
+# 512 KB over the default. Just enough to be able to deal with
+# reasonable styling applied to DOM trees whose depth is near what
+# Blink's HTML parser can output.
+WIN32_EXE_LDFLAGS += -STACK:1572864
endif
endif