]> Cypherpunks repositories - gostls13.git/commit
text/template: fix variadic function call corner case
authorDidier Spezia <didier.06@gmail.com>
Wed, 27 May 2015 11:44:19 +0000 (11:44 +0000)
committerRob Pike <r@golang.org>
Mon, 1 Jun 2015 22:06:40 +0000 (22:06 +0000)
commit5c60a4fb0a7f49105e2daa10efe45faf2bf3a36b
tree224042204c344034936ebedcb5b1989e7857f625
parentf6853369c315d69a77163756e916e784bfe2e281
text/template: fix variadic function call corner case

Executing a template involving variadic functions featuring
a []interface{} slice (such as printf) could result in a
panic in reflect.Value.Call, due to incorrect type checking.

The following expressions failed (with a panic):
{{true|printf}}
{{1|printf}}
{{1.1|printf}}
{{'x'|printf}}
{{1+2i|printf}}

Implemented proper type checks for the fixed parameters of the
variadic functions.

Fixes #10946

Change-Id: Ia75333f651f73b3d2e024cb0c47cc30d90cb6852
Reviewed-on: https://go-review.googlesource.com/10403
Reviewed-by: Rob Pike <r@golang.org>
src/text/template/exec.go
src/text/template/exec_test.go