summaryrefslogtreecommitdiffstats
path: root/tpl/template_test.go
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-04-30 13:25:45 +0200
committerbep <bjorn.erik.pedersen@gmail.com>2015-04-30 13:25:46 +0200
commitbe7b830f33ca947fc6109e631c40b1c3e10666dd (patch)
tree40e950cdd0f2bbf85652c3a1efede688d886f2ed /tpl/template_test.go
parentbe190fdb0d43592a3c8304fa4a1919a685e10b72 (diff)
tpl: add sanity check to prevent panic in seq on big nums
Fixes #1092
Diffstat (limited to 'tpl/template_test.go')
-rw-r--r--tpl/template_test.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/tpl/template_test.go b/tpl/template_test.go
index c7cd20f55..0c68516e5 100644
--- a/tpl/template_test.go
+++ b/tpl/template_test.go
@@ -8,6 +8,11 @@ import (
// Test for bugs discovered by https://github.com/dvyukov/go-fuzz
func TestTplGoFuzzReports(t *testing.T) {
+
+ // The following test case(s) also fail
+ // See https://github.com/golang/go/issues/10634
+ //{"{{ seq 433937734937734969526500969526500 }}", 2}}
+
for i, this := range []struct {
data string
expectErr int
@@ -17,7 +22,8 @@ func TestTplGoFuzzReports(t *testing.T) {
// Issue #1090
{"{{ slicestr \"000000\" 10}}", 2},
// Issue #1091
- {"{{apply .C \"first\" 0 0 0}}", 2}} {
+ {"{{apply .C \"first\" 0 0 0}}", 2},
+ {"{{seq 3e80}}", 2}} {
templ := New()
d := &Data{
@@ -26,6 +32,9 @@ func TestTplGoFuzzReports(t *testing.T) {
C: []int{1, 2, 3},
D: map[int]string{1: "foo", 2: "bar"},
E: Data1{42, "foo"},
+ F: []string{"a", "b", "c"},
+ G: []string{"a", "b", "c", "d", "e"},
+ H: "a,b,c,d,e,f",
}
err := templ.AddTemplate("fuzz", this.data)
@@ -52,6 +61,9 @@ type Data struct {
C []int
D map[int]string
E Data1
+ F []string
+ G []string
+ H string
}
type Data1 struct {