1
0
mirror of https://github.com/golang/go synced 2024-11-22 17:54:45 -07:00

html/template: replace bytes.Compare call with bytes.Equal

Change-Id: I1bd3fdf0ceb9a83dbcc07f55b81489eb2c82c9ba
GitHub-Last-Rev: 05d49d7fb9
GitHub-Pull-Request: golang/go#65418
Reviewed-on: https://go-review.googlesource.com/c/go/+/560115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
guoguangwu 2024-02-20 06:20:13 +00:00 committed by Gopher Robot
parent 8b94733bc7
commit dfb2a89474

View File

@ -414,7 +414,7 @@ func tJSDelimited(c context, s []byte) (context, int) {
// If "</script" appears in a regex literal, the '/' should not
// close the regex literal, and it will later be escaped to
// "\x3C/script" in escapeText.
if i > 0 && i+7 <= len(s) && bytes.Compare(bytes.ToLower(s[i-1:i+7]), []byte("</script")) == 0 {
if i > 0 && i+7 <= len(s) && bytes.Equal(bytes.ToLower(s[i-1 : i+7]), []byte("</script")) {
i++
} else if !inCharset {
c.state, c.jsCtx = stateJS, jsCtxDivOp