aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/text
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-08-04 16:48:28 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-08-04 16:48:28 +0000
commitaa8a418bbcb6c0f5053fb8a40f7586d7388b8bf5 (patch)
tree20a07a0f64a41d87dfe15d7680b5398a772d50e0 /libgo/go/text
parent7a62db9787f6a65e3057cab68e8453ca58716a1b (diff)
downloadgcc-aa8a418bbcb6c0f5053fb8a40f7586d7388b8bf5.zip
gcc-aa8a418bbcb6c0f5053fb8a40f7586d7388b8bf5.tar.gz
gcc-aa8a418bbcb6c0f5053fb8a40f7586d7388b8bf5.tar.bz2
text/template: reduce maxExecDepth for gccgo
When using gccgo on systems without full support for split stacks a recursive template can overrun the available stack space. Reduce the limit from 100000 to 10000 to make this less likely. It's still high enough that real uses will work. Reviewed-on: https://go-review.googlesource.com/25467 From-SVN: r239141
Diffstat (limited to 'libgo/go/text')
-rw-r--r--libgo/go/text/template/exec.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/libgo/go/text/template/exec.go b/libgo/go/text/template/exec.go
index 8e5ad93..7cf7bb6 100644
--- a/libgo/go/text/template/exec.go
+++ b/libgo/go/text/template/exec.go
@@ -19,7 +19,9 @@ import (
// templates. This limit is only practically reached by accidentally
// recursive template invocations. This limit allows us to return
// an error instead of triggering a stack overflow.
-const maxExecDepth = 100000
+// For gccgo we make this 10000 rather than 100000 to avoid stack overflow
+// on non-split-stack systems.
+const maxExecDepth = 10000
// state represents the state of an execution. It's not part of the
// template so that multiple executions of the same template