go/src/encoding
Didier Spezia ca1d6c4b44 encoding/xml: EncodeToken silently eats tokens with invalid type
EncodeToken takes a Token (i.e. an interface{}) as a parameter,
and expects a value of type StartElement, EndElement, CharData,
Comment, ProcInst, or Directive.

If a pointer is passed instead, or any type which does not match
this list, the token is silently ignored.

Added a default case in the type switch to issue a proper error
when the type is invalid.

The behavior could be later improved by allowing pointers to
token to be accepted as well, but not for go1.5.

Fixes #11719

Change-Id: Ifd13c1563450b474acf66d57669fdccba76c1949
Reviewed-on: https://go-review.googlesource.com/12252
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-23 14:16:01 +00:00
..
ascii85
asn1 encoding/asn1: don't parse invalid UTF-8. 2015-06-29 02:50:49 +00:00
base32
base64 encoding/base64: Optimize EncodeToString and DecodeString. 2015-04-24 01:45:43 +00:00
binary encoding/binary: update protobuf documentation link 2015-06-29 14:28:01 +00:00
csv encoding/csv: add examples for package 2015-06-22 11:11:37 +00:00
gob all: link to https for golang subdomains too 2015-07-12 04:42:40 +00:00
hex
json encoding/json: fix decoding of JSON null values 2015-07-22 15:39:54 +00:00
pem testing/quick: probabilistically generate nil pointers 2015-06-08 21:19:13 +00:00
xml encoding/xml: EncodeToken silently eats tokens with invalid type 2015-07-23 14:16:01 +00:00
encoding.go