tpl: check for too many arguments in apply

Fixes #1091
This commit is contained in:
bep committed 2015-04-30 11:41:27 +02:00
1 parent be017f187e
commit be190fdb0d
2 files changed
+5 -1

No files matched your search

+2
View File
@@ -668,6 +668,8 @@ func applyFnToThis(fn, this reflect.Value, args ...interface{}) (reflect.Value,
if len(args) < num { if len(args) < num {
return reflect.ValueOf(nil), errors.New("Too few arguments") return reflect.ValueOf(nil), errors.New("Too few arguments")
} else if len(args) > num {
return reflect.ValueOf(nil), errors.New("Too many arguments")
} }
res := fn.Call(n) res := fn.Call(n)
+3 -1
View File
@@ -15,7 +15,9 @@ func TestTplGoFuzzReports(t *testing.T) {
// Issue #1089 // Issue #1089
{"{{apply .C \"first\" }}", 2}, {"{{apply .C \"first\" }}", 2},
// Issue #1090 // Issue #1090
{"{{ slicestr \"000000\" 10}}", 2}} { {"{{ slicestr \"000000\" 10}}", 2},
// Issue #1091
{"{{apply .C \"first\" 0 0 0}}", 2}} {
templ := New() templ := New()
d := &Data{ d := &Data{