• Didier Spezia's avatar
    text/template: fix variadic function call corner case · 5c60a4fb
    Didier Spezia authored
    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/10403Reviewed-by: 's avatarRob Pike <r@golang.org>
    5c60a4fb
exec_test.go 36.1 KB