]> Cypherpunks repositories - gostls13.git/commit
html/template: fix pipeline sanitization
authorDidier Spezia <didier.06@gmail.com>
Wed, 6 May 2015 22:14:32 +0000 (22:14 +0000)
committerRob Pike <r@golang.org>
Fri, 8 May 2015 18:05:32 +0000 (18:05 +0000)
commit91d989eb6df17b0696cfd53e84b10ccb3f09c1dd
treef53b643935ff2b7e7bf1300545e4c5e35b53cd84
parent3a3773c8cb439034094025cf2f85ed52535c3e1f
html/template: fix pipeline sanitization

Pipelines are altered by inserting sanitizers if they are not
already present. The code makes the assumption that the first
operands of each commands are function identifiers.

This is wrong, since they can also be methods. It results in
a panic with templates such as {{1|print 2|.f 3}}

Adds an extra type assertion to make sure only identifiers
are compared with sanitizers.

Fixes #10673

Change-Id: I3eb820982675231dbfa970f197abc5ef335ce86b
Reviewed-on: https://go-review.googlesource.com/9801
Reviewed-by: Rob Pike <r@golang.org>
src/html/template/escape.go
src/html/template/escape_test.go