aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/xml/read.go
diff options
context:
space:
mode:
authorQuentin Smith <quentin@golang.org>2016-11-08 16:47:04 -0500
committerQuentin Smith <quentin@golang.org>2016-11-09 20:10:58 +0000
commit48c6048e554ff4f428aefd41b9345ed5ec634783 (patch)
tree7d96c9c85a53293aa929c09cf221373270f5d8d9 /src/encoding/xml/read.go
parent9c2037fbcf1a732f55e29062f3d30ddd21ca36d3 (diff)
downloadgo-48c6048e554ff4f428aefd41b9345ed5ec634783.tar.gz
go-48c6048e554ff4f428aefd41b9345ed5ec634783.zip
encoding/xml: check type when unmarshaling innerxml field
We only support unmarshaling into a string or a []byte, but we previously would try (and panic while) setting a slice of a different type. The docs say ",innerxml" is ignored if the type is not string or []byte, so do that for other slices as well. Fixes #15600. Change-Id: Ia64815945a14c3d04a0a45ccf413e38b58a69416 Reviewed-on: https://go-review.googlesource.com/32919 Run-TryBot: Quentin Smith <quentin@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/encoding/xml/read.go')
-rw-r--r--src/encoding/xml/read.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/encoding/xml/read.go b/src/encoding/xml/read.go
index ba62366560..ed4470f3eb 100644
--- a/src/encoding/xml/read.go
+++ b/src/encoding/xml/read.go
@@ -582,7 +582,9 @@ Loop:
case reflect.String:
t.SetString(string(saveXMLData))
case reflect.Slice:
- t.Set(reflect.ValueOf(saveXMLData))
+ if t.Type().Elem().Kind() == reflect.Uint8 {
+ t.Set(reflect.ValueOf(saveXMLData))
+ }
}
return nil