aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/xml/xml.go
diff options
context:
space:
mode:
authorDemi Marie Obenour <demi@invisiblethingslab.com>2024-09-03 01:33:29 +0000
committerGopher Robot <gobot@golang.org>2024-09-04 13:33:11 +0000
commit794b0a07483fdae7125f325d34fbea6b40a67885 (patch)
tree082e62e4cf6380d9b5ab59a891f7cb421ff63604 /src/encoding/xml/xml.go
parent6450a988a7ed81e8637c106abb7fbe318011dda8 (diff)
downloadgo-794b0a07483fdae7125f325d34fbea6b40a67885.tar.xz
encoding/xml: allow ]]> in attribute values
This is permitted by the XML specification. Fixes #68387 Change-Id: Ic4ab5520a08a5a997f1c3d13c6d5f80c0521e45c GitHub-Last-Rev: 6d2ac307bbd0ba7d50830ad8b879c00cc3a7242b GitHub-Pull-Request: golang/go#69197 Reviewed-on: https://go-review.googlesource.com/c/go/+/610056 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/encoding/xml/xml.go')
-rw-r--r--src/encoding/xml/xml.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/encoding/xml/xml.go b/src/encoding/xml/xml.go
index 0fe323f7c8..951676d403 100644
--- a/src/encoding/xml/xml.go
+++ b/src/encoding/xml/xml.go
@@ -1004,8 +1004,9 @@ Input:
}
// <![CDATA[ section ends with ]]>.
- // It is an error for ]]> to appear in ordinary text.
- if b0 == ']' && b1 == ']' && b == '>' {
+ // It is an error for ]]> to appear in ordinary text,
+ // but it is allowed in quoted strings.
+ if quote < 0 && b0 == ']' && b1 == ']' && b == '>' {
if cdata {
trunc = 2
break Input