[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    Re: [OE-core][dunfell][PATCH v3] go: Update fix for CVE-2023-24538 & CVE-2023-39318
From:       "Shubham Kulkarni via lists.openembedded.org" <skulkarni=mvista.com () lists ! openem
Date:       2023-09-30 15:53:25
Message-ID: CAKzga+woh5=FBs9Qhg0Xm1K1bFwKg42YOJbZ9THER2AXfRcnSw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Apologies Steve,

I will look into the issue and send a new patch for Dunfell. It worked for
me on my machine. Maybe something I missed.

Thanks,
Shubham Kulkarni

On Sat, Sep 30, 2023 at 8:02 AM Steve Sakoman <steve@sakoman.com> wrote:

> Sorry, this patch doesn't apply:
> 
> Applying: go: Update fix for CVE-2023-24538 & CVE-2023-39318
> error: corrupt patch at line 478
> error: could not build fake ancestor
> Patch failed at 0001 go: Update fix for CVE-2023-24538 & CVE-2023-39318
> 
> Steve
> 
> On Fri, Sep 29, 2023 at 9:21 AM Shubham Kulkarni via
> lists.openembedded.org <skulkarni=mvista.com@lists.openembedded.org>
> wrote:
> > 
> > From: Shubham Kulkarni <skulkarni@mvista.com>
> > 
> > Add missing files in fix for CVE-2023-24538 & CVE-2023-39318
> > 
> > Upstream Link -
> > CVE-2023-24538:
> https://github.com/golang/go/commit/b1e3ecfa06b67014429a197ec5e134ce4303ad9b
> > CVE-2023-39318:
> https://github.com/golang/go/commit/023b542edf38e2a1f87fcefb9f75ff2f99401b4c
> > 
> > Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
> > ---
> > meta/recipes-devtools/go/go-1.14.inc          |   5 +-
> > .../go/go-1.14/CVE-2023-24538-1.patch         |   4 +-
> > .../go/go-1.14/CVE-2023-24538-2.patch         | 447 ++++++++++++-
> > .../go/go-1.14/CVE-2023-24538_3.patch         | 393 ++++++++++++
> > .../go/go-1.14/CVE-2023-24538_4.patch         | 497 +++++++++++++++
> > .../go/go-1.14/CVE-2023-24538_5.patch         | 585 ++++++++++++++++++
> > ...3-24538-3.patch => CVE-2023-24538_6.patch} | 175 +++++-
> > .../go/go-1.14/CVE-2023-39318.patch           |  38 +-
> > 8 files changed, 2124 insertions(+), 20 deletions(-)
> > create mode 100644
> meta/recipes-devtools/go/go-1.14/CVE-2023-24538_3.patch
> > create mode 100644
> meta/recipes-devtools/go/go-1.14/CVE-2023-24538_4.patch
> > create mode 100644
> meta/recipes-devtools/go/go-1.14/CVE-2023-24538_5.patch
> > rename meta/recipes-devtools/go/go-1.14/{CVE-2023-24538-3.patch =>
> CVE-2023-24538_6.patch} (53%)
> > 
> > diff --git a/meta/recipes-devtools/go/go-1.14.inc
> b/meta/recipes-devtools/go/go-1.14.inc
> > index be63f64825..091b778de8 100644
> > --- a/meta/recipes-devtools/go/go-1.14.inc
> > +++ b/meta/recipes-devtools/go/go-1.14.inc
> > @@ -60,7 +60,10 @@ SRC_URI += "\
> > file://CVE-2023-24534.patch \
> > file://CVE-2023-24538-1.patch \
> > file://CVE-2023-24538-2.patch \
> > -    file://CVE-2023-24538-3.patch \
> > +    file://CVE-2023-24538_3.patch \
> > +    file://CVE-2023-24538_4.patch \
> > +    file://CVE-2023-24538_5.patch \
> > +    file://CVE-2023-24538_6.patch \
> > file://CVE-2023-24539.patch \
> > file://CVE-2023-24540.patch \
> > file://CVE-2023-29405-1.patch \
> > diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch
> b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch
> > index eda26e5ff6..23c5075e41 100644
> > --- a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch
> > +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch
> > @@ -1,7 +1,7 @@
> > From 8acd01094d9ee17f6e763a61e49a8a808b3a9ddb Mon Sep 17 00:00:00 2001
> > From: Brad Fitzpatrick <bradfitz@golang.org>
> > Date: Mon, 2 Aug 2021 14:55:51 -0700
> > -Subject: [PATCH 1/3] net/netip: add new IP address package
> > +Subject: [PATCH 1/6] net/netip: add new IP address package
> > 
> > Co-authored-by: Alex Willmer <alex@moreati.org.uk> (GitHub @moreati)
> > Co-authored-by: Alexander Yastrebov <yastrebov.alex@gmail.com>
> > @@ -31,7 +31,7 @@ Trust: Brad Fitzpatrick <bradfitz@golang.org>
> > 
> > Dependency Patch #1
> > 
> > -Upstream-Status: Backport [
> https://github.com/golang/go/commit/a59e33224e42d60a97fa720a45e1b74eb6aaa3d0
> ]
> > +Upstream-Status: Backport from
> https://github.com/golang/go/commit/a59e33224e42d60a97fa720a45e1b74eb6aaa3d0
> > CVE: CVE-2023-24538
> > Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
> > ---
> > diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch
> b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch
> > index 5036f2890b..3840617a32 100644
> > --- a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch
> > +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch
> > @@ -1,7 +1,7 @@
> > From 6fc21505614f36178df0dad7034b6b8e3f7588d5 Mon Sep 17 00:00:00 2001
> > From: empijei <robclap8@gmail.com>
> > Date: Fri, 27 Mar 2020 19:27:55 +0100
> > -Subject: [PATCH 2/3] html/template,text/template: switch to Unicode
> escapes
> > +Subject: [PATCH 2/6] html/template,text/template: switch to Unicode
> escapes
> > for JSON compatibility
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > @@ -31,10 +31,238 @@ Upstream-Status: Backport from
> https://github.com/golang/go/commit/d4d298040d072
> > CVE: CVE-2023-24538
> > Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
> > ---
> > - src/html/template/js.go    | 70
> +++++++++++++++++++++++++++-------------------
> > - src/text/template/funcs.go |  8 +++---
> > - 2 files changed, 46 insertions(+), 32 deletions(-)
> > + src/html/template/content_test.go  | 70
> +++++++++++++++++++-------------------
> > + src/html/template/escape_test.go   |  6 ++--
> > + src/html/template/example_test.go  |  6 ++--
> > + src/html/template/js.go            | 70
> +++++++++++++++++++++++---------------
> > + src/html/template/js_test.go       | 68
> ++++++++++++++++++------------------
> > + src/html/template/template_test.go | 39 +++++++++++++++++++++
> > + src/text/template/exec_test.go     |  6 ++--
> > + src/text/template/funcs.go         |  8 ++---
> > + 8 files changed, 163 insertions(+), 110 deletions(-)
> > 
> > +diff --git a/src/html/template/content_test.go
> b/src/html/template/content_test.go
> > +index 72d56f5..bd86527 100644
> > +--- a/src/html/template/content_test.go
> > ++++ b/src/html/template/content_test.go
> > +@@ -18,7 +18,7 @@ func TestTypedContent(t *testing.T) {
> > +               HTML(`Hello, <b>World</b> &amp;tc!`),
> > +               HTMLAttr(` dir="ltr"`),
> > +               JS(`c && alert("Hello, World!");`),
> > +-              JSStr(`Hello, World & O'Reilly\x21`),
> > ++              JSStr(`Hello, World & O'Reilly\u0021`),
> > +               URL(`greeting=H%69,&addressee=(World)`),
> > +               Srcset(`greeting=H%69,&addressee=(World) 2x,
> https://golang.org/favicon.ico 500.5w`),
> > +               URL(`,foo/,`),
> > +@@ -70,7 +70,7 @@ func TestTypedContent(t *testing.T) {
> > +                               `Hello, <b>World</b> &amp;tc!`,
> > +                               ` dir=&#34;ltr&#34;`,
> > +                               `c &amp;&amp; alert(&#34;Hello,
> World!&#34;);`,
> > +-                              `Hello, World &amp; O&#39;Reilly\x21`,
> > ++                              `Hello, World &amp; O&#39;Reilly\u0021`,
> > +                               `greeting=H%69,&amp;addressee=(World)`,
> > +                               `greeting=H%69,&amp;addressee=(World)
> 2x, https://golang.org/favicon.ico 500.5w`,
> > +                               `,foo/,`,
> > +@@ -100,7 +100,7 @@ func TestTypedContent(t *testing.T) {
> > +                               `Hello,&#32;World&#32;&amp;tc!`,
> > +                               `&#32;dir&#61;&#34;ltr&#34;`,
> > +
> `c&#32;&amp;&amp;&#32;alert(&#34;Hello,&#32;World!&#34;);`,
> > +-
> `Hello,&#32;World&#32;&amp;&#32;O&#39;Reilly\x21`,
> > ++
> `Hello,&#32;World&#32;&amp;&#32;O&#39;Reilly\u0021`,
> > +
> `greeting&#61;H%69,&amp;addressee&#61;(World)`,
> > +
> `greeting&#61;H%69,&amp;addressee&#61;(World)&#32;2x,&#32;
> https://golang.org/favicon.ico&#32;500.5w`
> <https://golang.org/favicon.ico&#32;500.5w>,
> > +                               `,foo/,`,
> > +@@ -115,7 +115,7 @@ func TestTypedContent(t *testing.T) {
> > +                               `Hello, World &amp;tc!`,
> > +                               ` dir=&#34;ltr&#34;`,
> > +                               `c &amp;&amp; alert(&#34;Hello,
> World!&#34;);`,
> > +-                              `Hello, World &amp; O&#39;Reilly\x21`,
> > ++                              `Hello, World &amp; O&#39;Reilly\u0021`,
> > +                               `greeting=H%69,&amp;addressee=(World)`,
> > +                               `greeting=H%69,&amp;addressee=(World)
> 2x, https://golang.org/favicon.ico 500.5w`,
> > +                               `,foo/,`,
> > +@@ -130,7 +130,7 @@ func TestTypedContent(t *testing.T) {
> > +                               `Hello, &lt;b&gt;World&lt;/b&gt;
> &amp;tc!`,
> > +                               ` dir=&#34;ltr&#34;`,
> > +                               `c &amp;&amp; alert(&#34;Hello,
> World!&#34;);`,
> > +-                              `Hello, World &amp; O&#39;Reilly\x21`,
> > ++                              `Hello, World &amp; O&#39;Reilly\u0021`,
> > +                               `greeting=H%69,&amp;addressee=(World)`,
> > +                               `greeting=H%69,&amp;addressee=(World)
> 2x, https://golang.org/favicon.ico 500.5w`,
> > +                               `,foo/,`,
> > +@@ -146,7 +146,7 @@ func TestTypedContent(t *testing.T) {
> > +                               // Not escaped.
> > +                               `c && alert("Hello, World!");`,
> > +                               // Escape sequence not over-escaped.
> > +-                              `"Hello, World & O'Reilly\x21"`,
> > ++                              `"Hello, World & O'Reilly\u0021"`,
> > +
> `"greeting=H%69,\u0026addressee=(World)"`,
> > +                               `"greeting=H%69,\u0026addressee=(World)
> 2x, https://golang.org/favicon.ico 500.5w"`,
> > +                               `",foo/,"`,
> > +@@ -162,7 +162,7 @@ func TestTypedContent(t *testing.T) {
> > +                               // Not JS escaped but HTML escaped.
> > +                               `c &amp;&amp; alert(&#34;Hello,
> World!&#34;);`,
> > +                               // Escape sequence not over-escaped.
> > +-                              `&#34;Hello, World &amp;
> O&#39;Reilly\x21&#34;`,
> > ++                              `&#34;Hello, World &amp;
> O&#39;Reilly\u0021&#34;`,
> > +
> `&#34;greeting=H%69,\u0026addressee=(World)&#34;`,
> > +
> `&#34;greeting=H%69,\u0026addressee=(World) 2x,
> https://golang.org/favicon.ico 500.5w&#34;`,
> > +                               `&#34;,foo/,&#34;`,
> > +@@ -171,30 +171,30 @@ func TestTypedContent(t *testing.T) {
> > +               {
> > +                       `<script>alert("{{.}}")</script>`,
> > +                       []string{
> > +-                              `\x3cb\x3e \x22foo%\x22 O\x27Reilly
> \x26bar;`,
> > +-                              `a[href =~ \x22\/\/example.com
> \x22]#foo`,
> > +-                              `Hello, \x3cb\x3eWorld\x3c\/b\x3e
> \x26amp;tc!`,
> > +-                              ` dir=\x22ltr\x22`,
> > +-                              `c \x26\x26 alert(\x22Hello,
> World!\x22);`,
> > ++                              `\u003cb\u003e \u0022foo%\u0022
> O\u0027Reilly \u0026bar;`,
> > ++                              `a[href =~ \u0022\/\/example.com
> \u0022]#foo`,
> > ++                              `Hello,
> \u003cb\u003eWorld\u003c\/b\u003e \u0026amp;tc!`,
> > ++                              ` dir=\u0022ltr\u0022`,
> > ++                              `c \u0026\u0026 alert(\u0022Hello,
> World!\u0022);`,
> > +                               // Escape sequence not over-escaped.
> > +-                              `Hello, World \x26 O\x27Reilly\x21`,
> > +-                              `greeting=H%69,\x26addressee=(World)`,
> > +-                              `greeting=H%69,\x26addressee=(World) 2x,
> https:\/\/golang.org\/favicon.ico 500.5w`,
> > ++                              `Hello, World \u0026
> O\u0027Reilly\u0021`,
> > ++                              `greeting=H%69,\u0026addressee=(World)`,
> > ++                              `greeting=H%69,\u0026addressee=(World)
> 2x, https:\/\/golang.org\/favicon.ico 500.5w`,
> > +                               `,foo\/,`,
> > +                       },
> > +               },
> > +               {
> > +                       `<script
> type="text/javascript">alert("{{.}}")</script>`,
> > +                       []string{
> > +-                              `\x3cb\x3e \x22foo%\x22 O\x27Reilly
> \x26bar;`,
> > +-                              `a[href =~ \x22\/\/example.com
> \x22]#foo`,
> > +-                              `Hello, \x3cb\x3eWorld\x3c\/b\x3e
> \x26amp;tc!`,
> > +-                              ` dir=\x22ltr\x22`,
> > +-                              `c \x26\x26 alert(\x22Hello,
> World!\x22);`,
> > ++                              `\u003cb\u003e \u0022foo%\u0022
> O\u0027Reilly \u0026bar;`,
> > ++                              `a[href =~ \u0022\/\/example.com
> \u0022]#foo`,
> > ++                              `Hello,
> \u003cb\u003eWorld\u003c\/b\u003e \u0026amp;tc!`,
> > ++                              ` dir=\u0022ltr\u0022`,
> > ++                              `c \u0026\u0026 alert(\u0022Hello,
> World!\u0022);`,
> > +                               // Escape sequence not over-escaped.
> > +-                              `Hello, World \x26 O\x27Reilly\x21`,
> > +-                              `greeting=H%69,\x26addressee=(World)`,
> > +-                              `greeting=H%69,\x26addressee=(World) 2x,
> https:\/\/golang.org\/favicon.ico 500.5w`,
> > ++                              `Hello, World \u0026
> O\u0027Reilly\u0021`,
> > ++                              `greeting=H%69,\u0026addressee=(World)`,
> > ++                              `greeting=H%69,\u0026addressee=(World)
> 2x, https:\/\/golang.org\/favicon.ico 500.5w`,
> > +                               `,foo\/,`,
> > +                       },
> > +               },
> > +@@ -208,7 +208,7 @@ func TestTypedContent(t *testing.T) {
> > +                               // Not escaped.
> > +                               `c && alert("Hello, World!");`,
> > +                               // Escape sequence not over-escaped.
> > +-                              `"Hello, World & O'Reilly\x21"`,
> > ++                              `"Hello, World & O'Reilly\u0021"`,
> > +
> `"greeting=H%69,\u0026addressee=(World)"`,
> > +                               `"greeting=H%69,\u0026addressee=(World)
> 2x, https://golang.org/favicon.ico 500.5w"`,
> > +                               `",foo/,"`,
> > +@@ -224,7 +224,7 @@ func TestTypedContent(t *testing.T) {
> > +                               `Hello, <b>World</b> &amp;tc!`,
> > +                               ` dir=&#34;ltr&#34;`,
> > +                               `c &amp;&amp; alert(&#34;Hello,
> World!&#34;);`,
> > +-                              `Hello, World &amp; O&#39;Reilly\x21`,
> > ++                              `Hello, World &amp; O&#39;Reilly\u0021`,
> > +                               `greeting=H%69,&amp;addressee=(World)`,
> > +                               `greeting=H%69,&amp;addressee=(World)
> 2x, https://golang.org/favicon.ico 500.5w`,
> > +                               `,foo/,`,
> > +@@ -233,15 +233,15 @@ func TestTypedContent(t *testing.T) {
> > +               {
> > +                       `<button onclick='alert("{{.}}")'>`,
> > +                       []string{
> > +-                              `\x3cb\x3e \x22foo%\x22 O\x27Reilly
> \x26bar;`,
> > +-                              `a[href =~ \x22\/\/example.com
> \x22]#foo`,
> > +-                              `Hello, \x3cb\x3eWorld\x3c\/b\x3e
> \x26amp;tc!`,
> > +-                              ` dir=\x22ltr\x22`,
> > +-                              `c \x26\x26 alert(\x22Hello,
> World!\x22);`,
> > ++                              `\u003cb\u003e \u0022foo%\u0022
> O\u0027Reilly \u0026bar;`,
> > ++                              `a[href =~ \u0022\/\/example.com
> \u0022]#foo`,
> > ++                              `Hello,
> \u003cb\u003eWorld\u003c\/b\u003e \u0026amp;tc!`,
> > ++                              ` dir=\u0022ltr\u0022`,
> > ++                              `c \u0026\u0026 alert(\u0022Hello,
> World!\u0022);`,
> > +                               // Escape sequence not over-escaped.
> > +-                              `Hello, World \x26 O\x27Reilly\x21`,
> > +-                              `greeting=H%69,\x26addressee=(World)`,
> > +-                              `greeting=H%69,\x26addressee=(World) 2x,
> https:\/\/golang.org\/favicon.ico 500.5w`,
> > ++                              `Hello, World \u0026
> O\u0027Reilly\u0021`,
> > ++                              `greeting=H%69,\u0026addressee=(World)`,
> > ++                              `greeting=H%69,\u0026addressee=(World)
> 2x, https:\/\/golang.org\/favicon.ico 500.5w`,
> > +                               `,foo\/,`,
> > +                       },
> > +               },
> > +@@ -253,7 +253,7 @@ func TestTypedContent(t *testing.T) {
> > +
> `Hello%2c%20%3cb%3eWorld%3c%2fb%3e%20%26amp%3btc%21`,
> > +                               `%20dir%3d%22ltr%22`,
> > +
> `c%20%26%26%20alert%28%22Hello%2c%20World%21%22%29%3b`,
> > +-
> `Hello%2c%20World%20%26%20O%27Reilly%5cx21`,
> > ++
> `Hello%2c%20World%20%26%20O%27Reilly%5cu0021`,
> > +                               // Quotes and parens are escaped but %69
> is not over-escaped. HTML escaping is done.
> > +
> `greeting=H%69,&amp;addressee=%28World%29`,
> > +
> `greeting%3dH%2569%2c%26addressee%3d%28World%29%202x%2c%20https%3a%2f%
> 2fgolang.org%2ffavicon.ico%20500.5w`,
> > +@@ -268,7 +268,7 @@ func TestTypedContent(t *testing.T) {
> > +
> `Hello%2c%20%3cb%3eWorld%3c%2fb%3e%20%26amp%3btc%21`,
> > +                               `%20dir%3d%22ltr%22`,
> > +
> `c%20%26%26%20alert%28%22Hello%2c%20World%21%22%29%3b`,
> > +-
> `Hello%2c%20World%20%26%20O%27Reilly%5cx21`,
> > ++
> `Hello%2c%20World%20%26%20O%27Reilly%5cu0021`,
> > +                               // Quotes and parens are escaped but %69
> is not over-escaped. HTML escaping is not done.
> > +                               `greeting=H%69,&addressee=%28World%29`,
> > +
> `greeting%3dH%2569%2c%26addressee%3d%28World%29%202x%2c%20https%3a%2f%
> 2fgolang.org%2ffavicon.ico%20500.5w`,
> > +diff --git a/src/html/template/escape_test.go
> b/src/html/template/escape_test.go
> > +index e72a9ba..c709660 100644
> > +--- a/src/html/template/escape_test.go
> > ++++ b/src/html/template/escape_test.go
> > +@@ -238,7 +238,7 @@ func TestEscape(t *testing.T) {
> > +               {
> > +                       "jsStr",
> > +                       "<button onclick='alert(&quot;{{.H}}&quot;)'>",
> > +-                      `<button
> onclick='alert(&quot;\x3cHello\x3e&quot;)'>`,
> > ++                      `<button
> onclick='alert(&quot;\u003cHello\u003e&quot;)'>`,
> > +               },
> > +               {
> > +                       "badMarshaler",
> > +@@ -259,7 +259,7 @@ func TestEscape(t *testing.T) {
> > +               {
> > +                       "jsRe",
> > +                       `<button
> onclick='alert(/{{"foo+bar"}}/.test(""))'>`,
> > +-                      `<button
> onclick='alert(/foo\x2bbar/.test(""))'>`,
> > ++                      `<button
> onclick='alert(/foo\u002bbar/.test(""))'>`,
> > +               },
> > +               {
> > +                       "jsReBlank",
> > +@@ -825,7 +825,7 @@ func TestEscapeSet(t *testing.T) {
> > +                               "main":   `<button
> onclick="title='{{template "helper"}}'; ...">{{template
> "helper"}}</button>`,
> > +                               "helper": `{{11}} of {{"<100>"}}`,
> > +                       },
> > +-                      `<button onclick="title='11 of \x3c100\x3e';
> ...">11 of &lt;100&gt;</button>`,
> > ++                      `<button onclick="title='11 of \u003c100\u003e';
> ...">11 of &lt;100&gt;</button>`,
> > +               },
> > +               // A non-recursive template that ends in a different
> context.
> > +               // helper starts in jsCtxRegexp and ends in jsCtxDivOp.
> > +diff --git a/src/html/template/example_test.go
> b/src/html/template/example_test.go
> > +index 9d965f1..6cf936f 100644
> > +--- a/src/html/template/example_test.go
> > ++++ b/src/html/template/example_test.go
> > +@@ -116,9 +116,9 @@ func Example_escape() {
> > +       // &#34;Fran &amp; Freddie&#39;s Diner&#34; &
> lt;tasty@example.com&gt;
> > +       // &#34;Fran &amp; Freddie&#39;s Diner&#34; &
> lt;tasty@example.com&gt;
> > +       // &#34;Fran &amp; Freddie&#39;s Diner&#
> 34;32&lt;tasty@example.com&gt;
> > +-      // \"Fran \x26 Freddie\'s Diner\" \x3Ctasty@example.com\x3E
> > +-      // \"Fran \x26 Freddie\'s Diner\" \x3Ctasty@example.com\x3E
> > +-      // \"Fran \x26 Freddie\'s Diner\"32\x3Ctasty@example.com\x3E
> > ++      // \"Fran \u0026 Freddie\'s Diner\" \u003Ctasty@example.com
> \u003E
> > ++      // \"Fran \u0026 Freddie\'s Diner\" \u003Ctasty@example.com
> \u003E
> > ++      // \"Fran \u0026 Freddie\'s Diner\"32\u003Ctasty@example.com
> \u003E
> > +       // %22Fran+%26+Freddie%27s+Diner%2232%3Ctasty%40example.com%3E
> > +
> > + }
> > diff --git a/src/html/template/js.go b/src/html/template/js.go
> > index 0e91458..ea9c183 100644
> > --- a/src/html/template/js.go
> > @@ -173,6 +401,217 @@ index 0e91458..ea9c183 100644
> > '?':  `\?`,
> > '[':  `\[`,
> > '\\': `\\`,
> > +diff --git a/src/html/template/js_test.go b/src/html/template/js_test.go
> > +index 075adaa..d7ee47b 100644
> > +--- a/src/html/template/js_test.go
> > ++++ b/src/html/template/js_test.go
> > +@@ -137,7 +137,7 @@ func TestJSValEscaper(t *testing.T) {
> > +               {"foo", `"foo"`},
> > +               // Newlines.
> > +               {"\r\n\u2028\u2029", `"\r\n\u2028\u2029"`},
> > +-              // "\v" == "v" on IE 6 so use "\x0b" instead.
> > ++              // "\v" == "v" on IE 6 so use "\u000b" instead.
> > +               {"\t\x0b", `"\t\u000b"`},
> > +               {struct{ X, Y int }{1, 2}, `{"X":1,"Y":2}`},
> > +               {[]interface{}{}, "[]"},
> > +@@ -173,7 +173,7 @@ func TestJSStrEscaper(t *testing.T) {
> > +       }{
> > +               {"", ``},
> > +               {"foo", `foo`},
> > +-              {"\u0000", `\0`},
> > ++              {"\u0000", `\u0000`},
> > +               {"\t", `\t`},
> > +               {"\n", `\n`},
> > +               {"\r", `\r`},
> > +@@ -183,14 +183,14 @@ func TestJSStrEscaper(t *testing.T) {
> > +               {"\\n", `\\n`},
> > +               {"foo\r\nbar", `foo\r\nbar`},
> > +               // Preserve attribute boundaries.
> > +-              {`"`, `\x22`},
> > +-              {`'`, `\x27`},
> > ++              {`"`, `\u0022`},
> > ++              {`'`, `\u0027`},
> > +               // Allow embedding in HTML without further escaping.
> > +-              {`&amp;`, `\x26amp;`},
> > ++              {`&amp;`, `\u0026amp;`},
> > +               // Prevent breaking out of text node and element
> boundaries.
> > +-              {"</script>", `\x3c\/script\x3e`},
> > +-              {"<![CDATA[", `\x3c![CDATA[`},
> > +-              {"]]>", `]]\x3e`},
> > ++              {"</script>", `\u003c\/script\u003e`},
> > ++              {"<![CDATA[", `\u003c![CDATA[`},
> > ++              {"]]>", `]]\u003e`},
> > +               //
> https://dev.w3.org/html5/markup/aria/syntax.html#escaping-text-span
> > +               //   "The text in style, script, title, and textarea
> elements
> > +               //   must not have an escaping text span start that is
> not
> > +@@ -201,11 +201,11 @@ func TestJSStrEscaper(t *testing.T) {
> > +               // allow regular text content to be interpreted as script
> > +               // allowing script execution via a combination of a JS
> string
> > +               // injection followed by an HTML text injection.
> > +-              {"<!--", `\x3c!--`},
> > +-              {"-->", `--\x3e`},
> > ++              {"<!--", `\u003c!--`},
> > ++              {"-->", `--\u003e`},
> > +               // From
> https://code.google.com/p/doctype/wiki/ArticleUtf7
> > +               {"+ADw-script+AD4-alert(1)+ADw-/script+AD4-",
> > +-
> `\x2bADw-script\x2bAD4-alert(1)\x2bADw-\/script\x2bAD4-`,
> > ++
> `\u002bADw-script\u002bAD4-alert(1)\u002bADw-\/script\u002bAD4-`,
> > +               },
> > +               // Invalid UTF-8 sequence
> > +               {"foo\xA0bar", "foo\xA0bar"},
> > +@@ -228,7 +228,7 @@ func TestJSRegexpEscaper(t *testing.T) {
> > +       }{
> > +               {"", `(?:)`},
> > +               {"foo", `foo`},
> > +-              {"\u0000", `\0`},
> > ++              {"\u0000", `\u0000`},
> > +               {"\t", `\t`},
> > +               {"\n", `\n`},
> > +               {"\r", `\r`},
> > +@@ -238,19 +238,19 @@ func TestJSRegexpEscaper(t *testing.T) {
> > +               {"\\n", `\\n`},
> > +               {"foo\r\nbar", `foo\r\nbar`},
> > +               // Preserve attribute boundaries.
> > +-              {`"`, `\x22`},
> > +-              {`'`, `\x27`},
> > ++              {`"`, `\u0022`},
> > ++              {`'`, `\u0027`},
> > +               // Allow embedding in HTML without further escaping.
> > +-              {`&amp;`, `\x26amp;`},
> > ++              {`&amp;`, `\u0026amp;`},
> > +               // Prevent breaking out of text node and element
> boundaries.
> > +-              {"</script>", `\x3c\/script\x3e`},
> > +-              {"<![CDATA[", `\x3c!\[CDATA\[`},
> > +-              {"]]>", `\]\]\x3e`},
> > ++              {"</script>", `\u003c\/script\u003e`},
> > ++              {"<![CDATA[", `\u003c!\[CDATA\[`},
> > ++              {"]]>", `\]\]\u003e`},
> > +               // Escaping text spans.
> > +-              {"<!--", `\x3c!\-\-`},
> > +-              {"-->", `\-\-\x3e`},
> > ++              {"<!--", `\u003c!\-\-`},
> > ++              {"-->", `\-\-\u003e`},
> > +               {"*", `\*`},
> > +-              {"+", `\x2b`},
> > ++              {"+", `\u002b`},
> > +               {"?", `\?`},
> > +               {"[](){}", `\[\]\(\)\{\}`},
> > +               {"$foo|x.y", `\$foo\|x\.y`},
> > +@@ -284,27 +284,27 @@ func
> TestEscapersOnLower7AndSelectHighCodepoints(t *testing.T) {
> > +               {
> > +                       "jsStrEscaper",
> > +                       jsStrEscaper,
> > +-                      "\\0\x01\x02\x03\x04\x05\x06\x07" +
> > +-                              "\x08\\t\\n\\x0b\\f\\r\x0E\x0F" +
> > +-                              "\x10\x11\x12\x13\x14\x15\x16\x17" +
> > +-                              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" +
> > +-                              ` !\x22#$%\x26\x27()*\x2b,-.\/` +
> > +-                              `0123456789:;\x3c=\x3e?` +
> > ++
> `\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007` +
> > ++                              `\u0008\t\n\u000b\f\r\u000e\u000f` +
> > ++
> `\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017` +
> > ++
> `\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f` +
> > ++                              ` !\u0022#$%\u0026\u0027()*\u002b,-.\/` +
> > ++                              `0123456789:;\u003c=\u003e?` +
> > +                               `@ABCDEFGHIJKLMNO` +
> > +                               `PQRSTUVWXYZ[\\]^_` +
> > +                               "`abcdefghijklmno" +
> > +-                              "pqrstuvwxyz{|}~\x7f" +
> > ++                              "pqrstuvwxyz{|}~\u007f" +
> > +
> "\u00A0\u0100\\u2028\\u2029\ufeff\U0001D11E",
> > +               },
> > +               {
> > +                       "jsRegexpEscaper",
> > +                       jsRegexpEscaper,
> > +-                      "\\0\x01\x02\x03\x04\x05\x06\x07" +
> > +-                              "\x08\\t\\n\\x0b\\f\\r\x0E\x0F" +
> > +-                              "\x10\x11\x12\x13\x14\x15\x16\x17" +
> > +-                              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" +
> > +-                              ` !\x22#\$%\x26\x27\(\)\*\x2b,\-\.\/` +
> > +-                              `0123456789:;\x3c=\x3e\?` +
> > ++
> `\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007` +
> > ++                              `\u0008\t\n\u000b\f\r\u000e\u000f` +
> > ++
> `\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017` +
> > ++
> `\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f` +
> > ++                              `
> !\u0022#\$%\u0026\u0027\(\)\*\u002b,\-\.\/` +
> > ++                              `0123456789:;\u003c=\u003e\?` +
> > +                               `@ABCDEFGHIJKLMNO` +
> > +                               `PQRSTUVWXYZ\[\\\]\^_` +
> > +                               "`abcdefghijklmno" +
> > +diff --git a/src/html/template/template_test.go
> b/src/html/template/template_test.go
> > +index 13e6ba4..86bd4db 100644
> > +--- a/src/html/template/template_test.go
> > ++++ b/src/html/template/template_test.go
> > +@@ -6,6 +6,7 @@ package template_test
> > +
> > + import (
> > +       "bytes"
> > ++      "encoding/json"
> > +       . "html/template"
> > +       "strings"
> > +       "testing"
> > +@@ -121,6 +122,44 @@ func TestNumbers(t *testing.T) {
> > +       c.mustExecute(c.root, nil, "12.34 7.5")
> > + }
> > +
> > ++func TestStringsInScriptsWithJsonContentTypeAreCorrectlyEscaped(t
> *testing.T) {
> > ++      // See #33671 and #37634 for more context on this.
> > ++      tests := []struct{ name, in string }{
> > ++              {"empty", ""},
> > ++              {"invalid", string(rune(-1))},
> > ++              {"null", "\u0000"},
> > ++              {"unit separator", "\u001F"},
> > ++              {"tab", "\t"},
> > ++              {"gt and lt", "<>"},
> > ++              {"quotes", `'"`},
> > ++              {"ASCII letters", "ASCII letters"},
> > ++              {"Unicode", "ʕ⊙ϖ⊙ʔ"},
> > ++              {"Pizza", "🍕"},
> > ++      }
> > ++      const (
> > ++              prefix = `<script type="application/ld+json">`
> > ++              suffix = `</script>`
> > ++              templ  = prefix + `"{{.}}"` + suffix
> > ++      )
> > ++      tpl := Must(New("JS string is JSON string").Parse(templ))
> > ++      for _, tt := range tests {
> > ++              t.Run(tt.name, func(t *testing.T) {
> > ++                      var buf bytes.Buffer
> > ++                      if err := tpl.Execute(&buf, tt.in); err != nil {
> > ++                              t.Fatalf("Cannot render template: %v",
> err)
> > ++                      }
> > ++                      trimmed :=
> bytes.TrimSuffix(bytes.TrimPrefix(buf.Bytes(), []byte(prefix)),
> []byte(suffix))
> > ++                      var got string
> > ++                      if err := json.Unmarshal(trimmed, &got); err !=
> nil {
> > ++                              t.Fatalf("Cannot parse JS string %q as
> JSON: %v", trimmed[1:len(trimmed)-1], err)
> > ++                      }
> > ++                      if got != tt.in {
> > ++                              t.Errorf("Serialization changed the
> string value: got %q want %q", got, tt.in)
> > ++                      }
> > ++              })
> > ++      }
> > ++}
> > ++
> > + type testCase struct {
> > +       t    *testing.T
> > +       root *Template
> > +diff --git a/src/text/template/exec_test.go
> b/src/text/template/exec_test.go
> > +index 77294ed..b8a809e 100644
> > +--- a/src/text/template/exec_test.go
> > ++++ b/src/text/template/exec_test.go
> > +@@ -911,9 +911,9 @@ func TestJSEscaping(t *testing.T) {
> > +               {`Go "jump" \`, `Go \"jump\" \\`},
> > +               {`Yukihiro says "今日は世界"`, `Yukihiro says \
> > \"今日は世界\"`}, +               {"unprintable \uFDFF", `unprintable \
> > \uFDFF`}, +-              {`<html>`, `\x3Chtml\x3E`},
> > +-              {`no = in attributes`, `no \x3D in attributes`},
> > +-              {`&#x27; does not become HTML entity`, `\x26#x27; does
> not become HTML entity`},
> > ++              {`<html>`, `\u003Chtml\u003E`},
> > ++              {`no = in attributes`, `no \u003D in attributes`},
> > ++              {`&#x27; does not become HTML entity`, `\u0026#x27; does
> not become HTML entity`},
> > +       }
> > +       for _, tc := range testCases {
> > +               s := JSEscapeString(tc.in)
> > diff --git a/src/text/template/funcs.go b/src/text/template/funcs.go
> > index 46125bc..f3de9fb 100644
> > --- a/src/text/template/funcs.go
> > diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_3.patch
> b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_3.patch
> > new file mode 100644
> > index 0000000000..cd7dd0957c
> > --- /dev/null
> > +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_3.patch
> > @@ -0,0 +1,393 @@
> > +From 7ddce23c7d5b728acf8482f5006497c7b9915f8a Mon Sep 17 00:00:00 2001
> > +From: Ariel Mashraki <ariel@mashraki.co.il>
> > +Date: Wed, 22 Apr 2020 22:17:56 +0300
> > +Subject: [PATCH 3/6] text/template: add CommentNode to template parse
> tree
> > +MIME-Version: 1.0
> > +Content-Type: text/plain; charset=UTF-8
> > +Content-Transfer-Encoding: 8bit
> > +
> > +Fixes #34652
> > +
> > +Change-Id: Icf6e3eda593fed826736f34f95a9d66f5450cc98
> > +Reviewed-on: https://go-review.googlesource.com/c/go/+/229398
> > +Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
> > +Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
> > +TryBot-Result: Gobot Gobot <gobot@golang.org>
> > +
> > +Dependency Patch #3
> > +
> > +Upstream-Status: Backport from
> https://github.com/golang/go/commit/c8ea03828b0645b1fd5725888e44873b75fcfbb6
> > +CVE: CVE-2023-24538
> > +Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
> > +---
> > + api/next.txt                          | 19 +++++++++++++++++++
> > + src/html/template/escape.go           |  2 ++
> > + src/html/template/template_test.go    | 16 ++++++++++++++++
> > + src/text/template/exec.go             |  1 +
> > + src/text/template/parse/lex.go        |  8 +++++++-
> > + src/text/template/parse/lex_test.go   |  7 +++++--
> > + src/text/template/parse/node.go       | 33
> +++++++++++++++++++++++++++++++++
> > + src/text/template/parse/parse.go      | 22 +++++++++++++++++++---
> > + src/text/template/parse/parse_test.go | 25 +++++++++++++++++++++++++
> > + 9 files changed, 127 insertions(+), 6 deletions(-)
> > +
> > +diff --git a/api/next.txt b/api/next.txt
> > +index e69de29..076f39e 100644
> > +--- a/api/next.txt
> > ++++ b/api/next.txt
> > +@@ -0,0 +1,19 @@
> > ++pkg unicode, const Version = "13.0.0"
> > ++pkg unicode, var Chorasmian *RangeTable
> > ++pkg unicode, var Dives_Akuru *RangeTable
> > ++pkg unicode, var Khitan_Small_Script *RangeTable
> > ++pkg unicode, var Yezidi *RangeTable
> > ++pkg text/template/parse, const NodeComment = 20
> > ++pkg text/template/parse, const NodeComment NodeType
> > ++pkg text/template/parse, const ParseComments = 1
> > ++pkg text/template/parse, const ParseComments Mode
> > ++pkg text/template/parse, method (*CommentNode) Copy() Node
> > ++pkg text/template/parse, method (*CommentNode) String() string
> > ++pkg text/template/parse, method (CommentNode) Position() Pos
> > ++pkg text/template/parse, method (CommentNode) Type() NodeType
> > ++pkg text/template/parse, type CommentNode struct
> > ++pkg text/template/parse, type CommentNode struct, Text string
> > ++pkg text/template/parse, type CommentNode struct, embedded NodeType
> > ++pkg text/template/parse, type CommentNode struct, embedded Pos
> > ++pkg text/template/parse, type Mode uint
> > ++pkg text/template/parse, type Tree struct, Mode Mode
> > +diff --git a/src/html/template/escape.go b/src/html/template/escape.go
> > +index f12dafa..8739735 100644
> > +--- a/src/html/template/escape.go
> > ++++ b/src/html/template/escape.go
> > +@@ -124,6 +124,8 @@ func (e *escaper) escape(c context, n parse.Node)
> context {
> > +       switch n := n.(type) {
> > +       case *parse.ActionNode:
> > +               return e.escapeAction(c, n)
> > ++      case *parse.CommentNode:
> > ++              return c
> > +       case *parse.IfNode:
> > +               return e.escapeBranch(c, &n.BranchNode, "if")
> > +       case *parse.ListNode:
> > +diff --git a/src/html/template/template_test.go
> b/src/html/template/template_test.go
> > +index 86bd4db..1f2c888 100644
> > +--- a/src/html/template/template_test.go
> > ++++ b/src/html/template/template_test.go
> > +@@ -10,6 +10,7 @@ import (
> > +       . "html/template"
> > +       "strings"
> > +       "testing"
> > ++      "text/template/parse"
> > + )
> > +
> > + func TestTemplateClone(t *testing.T) {
> > +@@ -160,6 +161,21 @@ func
> TestStringsInScriptsWithJsonContentTypeAreCorrectlyEscaped(t *testing.T) {
> > +       }
> > + }
> > +
> > ++func TestSkipEscapeComments(t *testing.T) {
> > ++      c := newTestCase(t)
> > ++      tr := parse.New("root")
> > ++      tr.Mode = parse.ParseComments
> > ++      newT, err := tr.Parse("{{/* A comment */}}{{ 1 }}{{/* Another
> comment */}}", "", "", make(map[string]*parse.Tree))
> > ++      if err != nil {
> > ++              t.Fatalf("Cannot parse template text: %v", err)
> > ++      }
> > ++      c.root, err = c.root.AddParseTree("root", newT)
> > ++      if err != nil {
> > ++              t.Fatalf("Cannot add parse tree to template: %v", err)
> > ++      }
> > ++      c.mustExecute(c.root, nil, "1")
> > ++}
> > ++
> > + type testCase struct {
> > +       t    *testing.T
> > +       root *Template
> > +diff --git a/src/text/template/exec.go b/src/text/template/exec.go
> > +index ac3e741..7ac5175 100644
> > +--- a/src/text/template/exec.go
> > ++++ b/src/text/template/exec.go
> > +@@ -256,6 +256,7 @@ func (s *state) walk(dot reflect.Value, node
> parse.Node) {
> > +               if len(node.Pipe.Decl) == 0 {
> > +                       s.printValue(node, val)
> > +               }
> > ++      case *parse.CommentNode:
> > +       case *parse.IfNode:
> > +               s.walkIfOrWith(parse.NodeIf, dot, node.Pipe, node.List,
> node.ElseList)
> > +       case *parse.ListNode:
> > +diff --git a/src/text/template/parse/lex.go
> b/src/text/template/parse/lex.go
> > +index 30371f2..e41373a 100644
> > +--- a/src/text/template/parse/lex.go
> > ++++ b/src/text/template/parse/lex.go
> > +@@ -41,6 +41,7 @@ const (
> > +       itemBool                         // boolean constant
> > +       itemChar                         // printable ASCII character;
> grab bag for comma etc.
> > +       itemCharConstant                 // character constant
> > ++      itemComment                      // comment text
> > +       itemComplex                      // complex constant (1+2i);
> imaginary is just a number
> > +       itemAssign                       // equals ('=') introducing an
> assignment
> > +       itemDeclare                      // colon-equals (':=')
> introducing a declaration
> > +@@ -112,6 +113,7 @@ type lexer struct {
> > +       leftDelim      string    // start of action
> > +       rightDelim     string    // end of action
> > +       trimRightDelim string    // end of action with trim marker
> > ++      emitComment    bool      // emit itemComment tokens.
> > +       pos            Pos       // current position in the input
> > +       start          Pos       // start position of this item
> > +       width          Pos       // width of last rune read from input
> > +@@ -203,7 +205,7 @@ func (l *lexer) drain() {
> > + }
> > +
> > + // lex creates a new scanner for the input string.
> > +-func lex(name, input, left, right string) *lexer {
> > ++func lex(name, input, left, right string, emitComment bool) *lexer {
> > +       if left == "" {
> > +               left = leftDelim
> > +       }
> > +@@ -216,6 +218,7 @@ func lex(name, input, left, right string) *lexer {
> > +               leftDelim:      left,
> > +               rightDelim:     right,
> > +               trimRightDelim: rightTrimMarker + right,
> > ++              emitComment:    emitComment,
> > +               items:          make(chan item),
> > +               line:           1,
> > +               startLine:      1,
> > +@@ -323,6 +326,9 @@ func lexComment(l *lexer) stateFn {
> > +       if !delim {
> > +               return l.errorf("comment ends before closing delimiter")
> > +       }
> > ++      if l.emitComment {
> > ++              l.emit(itemComment)
> > ++      }
> > +       if trimSpace {
> > +               l.pos += trimMarkerLen
> > +       }
> > +diff --git a/src/text/template/parse/lex_test.go
> b/src/text/template/parse/lex_test.go
> > +index 563c4fc..f6d5f28 100644
> > +--- a/src/text/template/parse/lex_test.go
> > ++++ b/src/text/template/parse/lex_test.go
> > +@@ -15,6 +15,7 @@ var itemName = map[itemType]string{
> > +       itemBool:         "bool",
> > +       itemChar:         "char",
> > +       itemCharConstant: "charconst",
> > ++      itemComment:      "comment",
> > +       itemComplex:      "complex",
> > +       itemDeclare:      ":=",
> > +       itemEOF:          "EOF",
> > +@@ -90,6 +91,7 @@ var lexTests = []lexTest{
> > +       {"text", `now is the time`, []item{mkItem(itemText, "now is the
> time"), tEOF}},
> > +       {"text with comment", "hello-{{/* this is a comment */}}-world",
> []item{
> > +               mkItem(itemText, "hello-"),
> > ++              mkItem(itemComment, "/* this is a comment */"),
> > +               mkItem(itemText, "-world"),
> > +               tEOF,
> > +       }},
> > +@@ -311,6 +313,7 @@ var lexTests = []lexTest{
> > +       }},
> > +       {"trimming spaces before and after comment", "hello- {{- /*
> hello */ -}} -world", []item{
> > +               mkItem(itemText, "hello-"),
> > ++              mkItem(itemComment, "/* hello */"),
> > +               mkItem(itemText, "-world"),
> > +               tEOF,
> > +       }},
> > +@@ -389,7 +392,7 @@ var lexTests = []lexTest{
> > +
> > + // collect gathers the emitted items into a slice.
> > + func collect(t *lexTest, left, right string) (items []item) {
> > +-      l := lex(t.name, t.input, left, right)
> > ++      l := lex(t.name, t.input, left, right, true)
> > +       for {
> > +               item := l.nextItem()
> > +               items = append(items, item)
> > +@@ -529,7 +532,7 @@ func TestPos(t *testing.T) {
> > + func TestShutdown(t *testing.T) {
> > +       // We need to duplicate template.Parse here to hold on to the
> lexer.
> > +       const text = "erroneous{{define}}{{else}}1234"
> > +-      lexer := lex("foo", text, "{{", "}}")
> > ++      lexer := lex("foo", text, "{{", "}}", false)
> > +       _, err := New("root").parseLexer(lexer)
> > +       if err == nil {
> > +               t.Fatalf("expected error")
> > +diff --git a/src/text/template/parse/node.go
> b/src/text/template/parse/node.go
> > +index 1c116ea..a9dad5e 100644
> > +--- a/src/text/template/parse/node.go
> > ++++ b/src/text/template/parse/node.go
> > +@@ -70,6 +70,7 @@ const (
> > +       NodeTemplate                   // A template invocation action.
> > +       NodeVariable                   // A $ variable.
> > +       NodeWith                       // A with action.
> > ++      NodeComment                    // A comment.
> > + )
> > +
> > + // Nodes.
> > +@@ -149,6 +150,38 @@ func (t *TextNode) Copy() Node {
> > +       return &TextNode{tr: t.tr, NodeType: NodeText, Pos: t.Pos,
> Text: append([]byte{}, t.Text...)}
> > + }
> > +
> > ++// CommentNode holds a comment.
> > ++type CommentNode struct {
> > ++      NodeType
> > ++      Pos
> > ++      tr   *Tree
> > ++      Text string // Comment text.
> > ++}
> > ++
> > ++func (t *Tree) newComment(pos Pos, text string) *CommentNode {
> > ++      return &CommentNode{tr: t, NodeType: NodeComment, Pos: pos,
> Text: text}
> > ++}
> > ++
> > ++func (c *CommentNode) String() string {
> > ++      var sb strings.Builder
> > ++      c.writeTo(&sb)
> > ++      return sb.String()
> > ++}
> > ++
> > ++func (c *CommentNode) writeTo(sb *strings.Builder) {
> > ++      sb.WriteString("{{")
> > ++      sb.WriteString(c.Text)
> > ++      sb.WriteString("}}")
> > ++}
> > ++
> > ++func (c *CommentNode) tree() *Tree {
> > ++      return c.tr
> > ++}
> > ++
> > ++func (c *CommentNode) Copy() Node {
> > ++      return &CommentNode{tr: c.tr, NodeType: NodeComment, Pos:
> c.Pos, Text: c.Text}
> > ++}
> > ++
> > + // PipeNode holds a pipeline with optional declaration
> > + type PipeNode struct {
> > +       NodeType
> > +diff --git a/src/text/template/parse/parse.go
> b/src/text/template/parse/parse.go
> > +index c9b80f4..496d8bf 100644
> > +--- a/src/text/template/parse/parse.go
> > ++++ b/src/text/template/parse/parse.go
> > +@@ -21,6 +21,7 @@ type Tree struct {
> > +       Name      string    // name of the template represented by the
> tree.
> > +       ParseName string    // name of the top-level template during
> parsing, for error messages.
> > +       Root      *ListNode // top-level root of the tree.
> > ++      Mode      Mode      // parsing mode.
> > +       text      string    // text parsed to create the template (or
> its parent)
> > +       // Parsing only; cleared after parse.
> > +       funcs     []map[string]interface{}
> > +@@ -29,8 +30,16 @@ type Tree struct {
> > +       peekCount int
> > +       vars      []string // variables defined at the moment.
> > +       treeSet   map[string]*Tree
> > ++      mode      Mode
> > + }
> > +
> > ++// A mode value is a set of flags (or 0). Modes control parser
> behavior.
> > ++type Mode uint
> > ++
> > ++const (
> > ++      ParseComments Mode = 1 << iota // parse comments and add them to
> AST
> > ++)
> > ++
> > + // Copy returns a copy of the Tree. Any parsing state is discarded.
> > + func (t *Tree) Copy() *Tree {
> > +       if t == nil {
> > +@@ -220,7 +229,8 @@ func (t *Tree) stopParse() {
> > + func (t *Tree) Parse(text, leftDelim, rightDelim string, treeSet
> map[string]*Tree, funcs ...map[string]interface{}) (tree *Tree, err error) {
> > +       defer t.recover(&err)
> > +       t.ParseName = t.Name
> > +-      t.startParse(funcs, lex(t.Name, text, leftDelim, rightDelim),
> treeSet)
> > ++      emitComment := t.Mode&ParseComments != 0
> > ++      t.startParse(funcs, lex(t.Name, text, leftDelim, rightDelim,
> emitComment), treeSet)
> > +       t.text = text
> > +       t.parse()
> > +       t.add()
> > +@@ -240,12 +250,14 @@ func (t *Tree) add() {
> > +       }
> > + }
> > +
> > +-// IsEmptyTree reports whether this tree (node) is empty of everything
> but space.
> > ++// IsEmptyTree reports whether this tree (node) is empty of everything
> but space or comments.
> > + func IsEmptyTree(n Node) bool {
> > +       switch n := n.(type) {
> > +       case nil:
> > +               return true
> > +       case *ActionNode:
> > ++      case *CommentNode:
> > ++              return true
> > +       case *IfNode:
> > +       case *ListNode:
> > +               for _, node := range n.Nodes {
> > +@@ -276,6 +288,7 @@ func (t *Tree) parse() {
> > +                       if t.nextNonSpace().typ == itemDefine {
> > +                               newT := New("definition") // name will
> be updated once we know it.
> > +                               newT.text = t.text
> > ++                              newT.Mode = t.Mode
> > +                               newT.ParseName = t.ParseName
> > +                               newT.startParse(t.funcs, t.lex,
> t.treeSet)
> > +                               newT.parseDefinition()
> > +@@ -331,13 +344,15 @@ func (t *Tree) itemList() (list *ListNode, next
> Node) {
> > + }
> > +
> > + // textOrAction:
> > +-//    text | action
> > ++//    text | comment | action
> > + func (t *Tree) textOrAction() Node {
> > +       switch token := t.nextNonSpace(); token.typ {
> > +       case itemText:
> > +               return t.newText(token.pos, token.val)
> > +       case itemLeftDelim:
> > +               return t.action()
> > ++      case itemComment:
> > ++              return t.newComment(token.pos, token.val)
> > +       default:
> > +               t.unexpected(token, "input")
> > +       }
> > +@@ -539,6 +554,7 @@ func (t *Tree) blockControl() Node {
> > +
> > +       block := New(name) // name will be updated once we know it.
> > +       block.text = t.text
> > ++      block.Mode = t.Mode
> > +       block.ParseName = t.ParseName
> > +       block.startParse(t.funcs, t.lex, t.treeSet)
> > +       var end Node
> > +diff --git a/src/text/template/parse/parse_test.go
> b/src/text/template/parse/parse_test.go
> > +index 4e09a78..d9c13c5 100644
> > +--- a/src/text/template/parse/parse_test.go
> > ++++ b/src/text/template/parse/parse_test.go
> > +@@ -348,6 +348,30 @@ func TestParseCopy(t *testing.T) {
> > +       testParse(true, t)
> > + }
> > +
> > ++func TestParseWithComments(t *testing.T) {
> > ++      textFormat = "%q"
> > ++      defer func() { textFormat = "%s" }()
> > ++      tests := [...]parseTest{
> > ++              {"comment", "{{/*\n\n\n*/}}", noError, "{{/*\n\n\n*/}}"},
> > ++              {"comment trim left", "x \r\n\t{{- /* hi */}}", noError,
> `"x"{{/* hi */}}`},
> > ++              {"comment trim right", "{{/* hi */ -}}\n\n\ty", noError,
> `{{/* hi */}}"y"`},
> > ++              {"comment trim left and right", "x \r\n\t{{- /* */
> -}}\n\n\ty", noError, `"x"{{/* */}}"y"`},
> > ++      }
> > ++      for _, test := range tests {
> > ++              t.Run(test.name, func(t *testing.T) {
> > ++                      tr := New(test.name)
> > ++                      tr.Mode = ParseComments
> > ++                      tmpl, err := tr.Parse(test.input, "", "",
> make(map[string]*Tree))
> > ++                      if err != nil {
> > ++                              t.Errorf("%q: expected error; got none",
> test.name)
> > ++                      }
> > ++                      if result := tmpl.Root.String(); result !=
> test.result {
> > ++                              t.Errorf("%s=(%q):
> got\n\t%v\nexpected\n\t%v", test.name, test.input, result, test.result)
> > ++                      }
> > ++              })
> > ++      }
> > ++}
> > ++
> > + type isEmptyTest struct {
> > +       name  string
> > +       input string
> > +@@ -358,6 +382,7 @@ var isEmptyTests = []isEmptyTest{
> > +       {"empty", ``, true},
> > +       {"nonempty", `hello`, false},
> > +       {"spaces only", " \t\n \t\n", true},
> > ++      {"comment only", "{{/* comment */}}", true},
> > +       {"definition", `{{define "x"}}something{{end}}`, true},
> > +       {"definitions and space", "{{define
> `x`}}something{{end}}\n\n{{define `y`}}something{{end}}\n\n", true},
> > +       {"definitions and text", "{{define
> `x`}}something{{end}}\nx\n{{define `y`}}something{{end}}\ny\n", false},
> > +--
> > +2.7.4
> > diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_4.patch
> b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_4.patch
> > new file mode 100644
> > index 0000000000..d5e2eb6684
> > --- /dev/null
> > +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_4.patch
> > @@ -0,0 +1,497 @@
> > +From 760d88497091fb5d6d231a18e6f4e06ecb9af9b2 Mon Sep 17 00:00:00 2001
> > +From: Russ Cox <rsc@golang.org>
> > +Date: Thu, 10 Sep 2020 18:53:26 -0400
> > +Subject: [PATCH 4/6] text/template: allow newlines inside action
> delimiters
> > +
> > +This allows multiline constructs like:
> > +
> > +       {{"hello" |
> > +         printf}}
> > +
> > +Now that unclosed actions can span multiple lines,
> > +track and report the start of the action when reporting errors.
> > +
> > +Also clean up a few "unexpected <error message>" to be just "<error
> message>".
> > +
> > +Fixes #29770.
> > +
> > +Change-Id: I54c6c016029a8328b7902a4b6d85eab713ec3285
> > +Reviewed-on: https://go-review.googlesource.com/c/go/+/254257
> > +Trust: Russ Cox <rsc@golang.org>
> > +Run-TryBot: Russ Cox <rsc@golang.org>
> > +TryBot-Result: Go Bot <gobot@golang.org>
> > +Reviewed-by: Rob Pike <r@golang.org>
> > +
> > +Dependency Patch #4
> > +
> > +Upstream-Status: Backport from
> https://github.com/golang/go/commit/9384d34c58099657bb1b133beaf3ff37ada9b017
> > +CVE: CVE-2023-24538
> > +Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
> > +---
> > + src/text/template/doc.go              | 21 ++++-----
> > + src/text/template/exec_test.go        |  2 +-
> > + src/text/template/parse/lex.go        | 84
> +++++++++++++++++------------------
> > + src/text/template/parse/lex_test.go   |  2 +-
> > + src/text/template/parse/parse.go      | 59 +++++++++++++-----------
> > + src/text/template/parse/parse_test.go | 36 ++++++++++++---
> > + 6 files changed, 117 insertions(+), 87 deletions(-)
> > +
> > +diff --git a/src/text/template/doc.go b/src/text/template/doc.go
> > +index 4b0efd2..7b30294 100644
> > +--- a/src/text/template/doc.go
> > ++++ b/src/text/template/doc.go
> > +@@ -40,16 +40,17 @@ More intricate examples appear below.
> > + Text and spaces
> > +
> > + By default, all text between actions is copied verbatim when the
> template is
> > +-executed. For example, the string " items are made of " in the example
> above appears
> > +-on standard output when the program is run.
> > +-
> > +-However, to aid in formatting template source code, if an action's
> left delimiter
> > +-(by default "{{") is followed immediately by a minus sign and ASCII
> space character
> > +-("{{- "), all trailing white space is trimmed from the immediately
> preceding text.
> > +-Similarly, if the right delimiter ("}}") is preceded by a space and
> minus sign
> > +-(" -}}"), all leading white space is trimmed from the immediately
> following text.
> > +-In these trim markers, the ASCII space must be present; "{{-3}}"
> parses as an
> > +-action containing the number -3.
> > ++executed. For example, the string " items are made of " in the example
> above
> > ++appears on standard output when the program is run.
> > ++
> > ++However, to aid in formatting template source code, if an action's left
> > ++delimiter (by default "{{") is followed immediately by a minus sign
> and white
> > ++space, all trailing white space is trimmed from the immediately
> preceding text.
> > ++Similarly, if the right delimiter ("}}") is preceded by white space
> and a minus
> > ++sign, all leading white space is trimmed from the immediately
> following text.
> > ++In these trim markers, the white space must be present:
> > ++"{{- 3}}" is like "{{3}}" but trims the immediately preceding text,
> while
> > ++"{{-3}}" parses as an action containing the number -3.
> > +
> > + For instance, when executing the template whose source is
> > +
> > +diff --git a/src/text/template/exec_test.go
> b/src/text/template/exec_test.go
> > +index b8a809e..3309b33 100644
> > +--- a/src/text/template/exec_test.go
> > ++++ b/src/text/template/exec_test.go
> > +@@ -1295,7 +1295,7 @@ func TestUnterminatedStringError(t *testing.T) {
> > +               t.Fatal("expected error")
> > +       }
> > +       str := err.Error()
> > +-      if !strings.Contains(str, "X:3: unexpected unterminated raw
> quoted string") {
> > ++      if !strings.Contains(str, "X:3: unterminated raw quoted string")
> {
> > +               t.Fatalf("unexpected error: %s", str)
> > +       }
> > + }
> > +diff --git a/src/text/template/parse/lex.go
> b/src/text/template/parse/lex.go
> > +index e41373a..6784071 100644
> > +--- a/src/text/template/parse/lex.go
> > ++++ b/src/text/template/parse/lex.go
> > +@@ -92,15 +92,14 @@ const eof = -1
> > + // If the action begins "{{- " rather than "{{", then all
> space/tab/newlines
> > + // preceding the action are trimmed; conversely if it ends " -}}" the
> > + // leading spaces are trimmed. This is done entirely in the lexer; the
> > +-// parser never sees it happen. We require an ASCII space to be
> > +-// present to avoid ambiguity with things like "{{-3}}". It reads
> > ++// parser never sees it happen. We require an ASCII space (' ', \t,
> \r, \n)
> > ++// to be present to avoid ambiguity with things like "{{-3}}". It reads
> > + // better with the space present anyway. For simplicity, only ASCII
> > +-// space does the job.
> > ++// does the job.
> > + const (
> > +-      spaceChars      = " \t\r\n" // These are the space characters
> defined by Go itself.
> > +-      leftTrimMarker  = "- "      // Attached to left delimiter, trims
> trailing spaces from preceding text.
> > +-      rightTrimMarker = " -"      // Attached to right delimiter,
> trims leading spaces from following text.
> > +-      trimMarkerLen   = Pos(len(leftTrimMarker))
> > ++      spaceChars    = " \t\r\n"  // These are the space characters
> defined by Go itself.
> > ++      trimMarker    = '-'        // Attached to left/right delimiter,
> trims trailing spaces from preceding/following text.
> > ++      trimMarkerLen = Pos(1 + 1) // marker plus space before or after
> > + )
> > +
> > + // stateFn represents the state of the scanner as a function that
> returns the next state.
> > +@@ -108,19 +107,18 @@ type stateFn func(*lexer) stateFn
> > +
> > + // lexer holds the state of the scanner.
> > + type lexer struct {
> > +-      name           string    // the name of the input; used only for
> error reports
> > +-      input          string    // the string being scanned
> > +-      leftDelim      string    // start of action
> > +-      rightDelim     string    // end of action
> > +-      trimRightDelim string    // end of action with trim marker
> > +-      emitComment    bool      // emit itemComment tokens.
> > +-      pos            Pos       // current position in the input
> > +-      start          Pos       // start position of this item
> > +-      width          Pos       // width of last rune read from input
> > +-      items          chan item // channel of scanned items
> > +-      parenDepth     int       // nesting depth of ( ) exprs
> > +-      line           int       // 1+number of newlines seen
> > +-      startLine      int       // start line of this item
> > ++      name        string    // the name of the input; used only for
> error reports
> > ++      input       string    // the string being scanned
> > ++      leftDelim   string    // start of action
> > ++      rightDelim  string    // end of action
> > ++      emitComment bool      // emit itemComment tokens.
> > ++      pos         Pos       // current position in the input
> > ++      start       Pos       // start position of this item
> > ++      width       Pos       // width of last rune read from input
> > ++      items       chan item // channel of scanned items
> > ++      parenDepth  int       // nesting depth of ( ) exprs
> > ++      line        int       // 1+number of newlines seen
> > ++      startLine   int       // start line of this item
> > + }
> > +
> > + // next returns the next rune in the input.
> > +@@ -213,15 +211,14 @@ func lex(name, input, left, right string,
> emitComment bool) *lexer {
> > +               right = rightDelim
> > +       }
> > +       l := &lexer{
> > +-              name:           name,
> > +-              input:          input,
> > +-              leftDelim:      left,
> > +-              rightDelim:     right,
> > +-              trimRightDelim: rightTrimMarker + right,
> > +-              emitComment:    emitComment,
> > +-              items:          make(chan item),
> > +-              line:           1,
> > +-              startLine:      1,
> > ++              name:        name,
> > ++              input:       input,
> > ++              leftDelim:   left,
> > ++              rightDelim:  right,
> > ++              emitComment: emitComment,
> > ++              items:       make(chan item),
> > ++              line:        1,
> > ++              startLine:   1,
> > +       }
> > +       go l.run()
> > +       return l
> > +@@ -251,7 +248,7 @@ func lexText(l *lexer) stateFn {
> > +               ldn := Pos(len(l.leftDelim))
> > +               l.pos += Pos(x)
> > +               trimLength := Pos(0)
> > +-              if strings.HasPrefix(l.input[l.pos+ldn:],
> leftTrimMarker) {
> > ++              if hasLeftTrimMarker(l.input[l.pos+ldn:]) {
> > +                       trimLength =
> rightTrimLength(l.input[l.start:l.pos])
> > +               }
> > +               l.pos -= trimLength
> > +@@ -280,7 +277,7 @@ func rightTrimLength(s string) Pos {
> > +
> > + // atRightDelim reports whether the lexer is at a right delimiter,
> possibly preceded by a trim marker.
> > + func (l *lexer) atRightDelim() (delim, trimSpaces bool) {
> > +-      if strings.HasPrefix(l.input[l.pos:], l.trimRightDelim) { //
> With trim marker.
> > ++      if hasRightTrimMarker(l.input[l.pos:]) &&
> strings.HasPrefix(l.input[l.pos+trimMarkerLen:], l.rightDelim) { // With
> trim marker.
> > +               return true, true
> > +       }
> > +       if strings.HasPrefix(l.input[l.pos:], l.rightDelim) { // Without
> trim marker.
> > +@@ -297,7 +294,7 @@ func leftTrimLength(s string) Pos {
> > + // lexLeftDelim scans the left delimiter, which is known to be
> present, possibly with a trim marker.
> > + func lexLeftDelim(l *lexer) stateFn {
> > +       l.pos += Pos(len(l.leftDelim))
> > +-      trimSpace := strings.HasPrefix(l.input[l.pos:], leftTrimMarker)
> > ++      trimSpace := hasLeftTrimMarker(l.input[l.pos:])
> > +       afterMarker := Pos(0)
> > +       if trimSpace {
> > +               afterMarker = trimMarkerLen
> > +@@ -342,7 +339,7 @@ func lexComment(l *lexer) stateFn {
> > +
> > + // lexRightDelim scans the right delimiter, which is known to be
> present, possibly with a trim marker.
> > + func lexRightDelim(l *lexer) stateFn {
> > +-      trimSpace := strings.HasPrefix(l.input[l.pos:], rightTrimMarker)
> > ++      trimSpace := hasRightTrimMarker(l.input[l.pos:])
> > +       if trimSpace {
> > +               l.pos += trimMarkerLen
> > +               l.ignore()
> > +@@ -369,7 +366,7 @@ func lexInsideAction(l *lexer) stateFn {
> > +               return l.errorf("unclosed left paren")
> > +       }
> > +       switch r := l.next(); {
> > +-      case r == eof || isEndOfLine(r):
> > ++      case r == eof:
> > +               return l.errorf("unclosed action")
> > +       case isSpace(r):
> > +               l.backup() // Put space back in case we have " -}}".
> > +@@ -439,7 +436,7 @@ func lexSpace(l *lexer) stateFn {
> > +       }
> > +       // Be careful about a trim-marked closing delimiter, which has a
> minus
> > +       // after a space. We know there is a space, so check for the '-'
> that might follow.
> > +-      if strings.HasPrefix(l.input[l.pos-1:], l.trimRightDelim) {
> > ++      if hasRightTrimMarker(l.input[l.pos-1:]) &&
> strings.HasPrefix(l.input[l.pos-1+trimMarkerLen:], l.rightDelim) {
> > +               l.backup() // Before the space.
> > +               if numSpaces == 1 {
> > +                       return lexRightDelim // On the delim, so go
> right to that.
> > +@@ -526,7 +523,7 @@ func lexFieldOrVariable(l *lexer, typ itemType)
> stateFn {
> > + // day to implement arithmetic.
> > + func (l *lexer) atTerminator() bool {
> > +       r := l.peek()
> > +-      if isSpace(r) || isEndOfLine(r) {
> > ++      if isSpace(r) {
> > +               return true
> > +       }
> > +       switch r {
> > +@@ -657,15 +654,18 @@ Loop:
> > +
> > + // isSpace reports whether r is a space character.
> > + func isSpace(r rune) bool {
> > +-      return r == ' ' || r == '\t'
> > +-}
> > +-
> > +-// isEndOfLine reports whether r is an end-of-line character.
> > +-func isEndOfLine(r rune) bool {
> > +-      return r == '\r' || r == '\n'
> > ++      return r == ' ' || r == '\t' || r == '\r' || r == '\n'
> > + }
> > +
> > + // isAlphaNumeric reports whether r is an alphabetic, digit, or
> underscore.
> > + func isAlphaNumeric(r rune) bool {
> > +       return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)
> > + }
> > ++
> > ++func hasLeftTrimMarker(s string) bool {
> > ++      return len(s) >= 2 && s[0] == trimMarker && isSpace(rune(s[1]))
> > ++}
> > ++
> > ++func hasRightTrimMarker(s string) bool {
> > ++      return len(s) >= 2 && isSpace(rune(s[0])) && s[1] == trimMarker
> > ++}
> > +diff --git a/src/text/template/parse/lex_test.go
> b/src/text/template/parse/lex_test.go
> > +index f6d5f28..6510eed 100644
> > +--- a/src/text/template/parse/lex_test.go
> > ++++ b/src/text/template/parse/lex_test.go
> > +@@ -323,7 +323,7 @@ var lexTests = []lexTest{
> > +               tLeft,
> > +               mkItem(itemError, "unrecognized character in action:
> U+0001"),
> > +       }},
> > +-      {"unclosed action", "{{\n}}", []item{
> > ++      {"unclosed action", "{{", []item{
> > +               tLeft,
> > +               mkItem(itemError, "unclosed action"),
> > +       }},
> > +diff --git a/src/text/template/parse/parse.go
> b/src/text/template/parse/parse.go
> > +index 496d8bf..5e6e512 100644
> > +--- a/src/text/template/parse/parse.go
> > ++++ b/src/text/template/parse/parse.go
> > +@@ -24,13 +24,14 @@ type Tree struct {
> > +       Mode      Mode      // parsing mode.
> > +       text      string    // text parsed to create the template (or
> its parent)
> > +       // Parsing only; cleared after parse.
> > +-      funcs     []map[string]interface{}
> > +-      lex       *lexer
> > +-      token     [3]item // three-token lookahead for parser.
> > +-      peekCount int
> > +-      vars      []string // variables defined at the moment.
> > +-      treeSet   map[string]*Tree
> > +-      mode      Mode
> > ++      funcs      []map[string]interface{}
> > ++      lex        *lexer
> > ++      token      [3]item // three-token lookahead for parser.
> > ++      peekCount  int
> > ++      vars       []string // variables defined at the moment.
> > ++      treeSet    map[string]*Tree
> > ++      actionLine int // line of left delim starting action
> > ++      mode       Mode
> > + }
> > +
> > + // A mode value is a set of flags (or 0). Modes control parser
> behavior.
> > +@@ -187,6 +188,16 @@ func (t *Tree) expectOneOf(expected1, expected2
> itemType, context string) item {
> > +
> > + // unexpected complains about the token and terminates processing.
> > + func (t *Tree) unexpected(token item, context string) {
> > ++      if token.typ == itemError {
> > ++              extra := ""
> > ++              if t.actionLine != 0 && t.actionLine != token.line {
> > ++                      extra = fmt.Sprintf(" in action started at
> %s:%d", t.ParseName, t.actionLine)
> > ++                      if strings.HasSuffix(token.val, " action") {
> > ++                              extra = extra[len(" in action"):] //
> avoid "action in action"
> > ++                      }
> > ++              }
> > ++              t.errorf("%s%s", token, extra)
> > ++      }
> > +       t.errorf("unexpected %s in %s", token, context)
> > + }
> > +
> > +@@ -350,6 +361,8 @@ func (t *Tree) textOrAction() Node {
> > +       case itemText:
> > +               return t.newText(token.pos, token.val)
> > +       case itemLeftDelim:
> > ++              t.actionLine = token.line
> > ++              defer t.clearActionLine()
> > +               return t.action()
> > +       case itemComment:
> > +               return t.newComment(token.pos, token.val)
> > +@@ -359,6 +372,10 @@ func (t *Tree) textOrAction() Node {
> > +       return nil
> > + }
> > +
> > ++func (t *Tree) clearActionLine() {
> > ++      t.actionLine = 0
> > ++}
> > ++
> > + // Action:
> > + //    control
> > + //    command ("|" command)*
> > +@@ -384,12 +401,12 @@ func (t *Tree) action() (n Node) {
> > +       t.backup()
> > +       token := t.peek()
> > +       // Do not pop variables; they persist until "end".
> > +-      return t.newAction(token.pos, token.line, t.pipeline("command"))
> > ++      return t.newAction(token.pos, token.line, t.pipeline("command",
> itemRightDelim))
> > + }
> > +
> > + // Pipeline:
> > + //    declarations? command ('|' command)*
> > +-func (t *Tree) pipeline(context string) (pipe *PipeNode) {
> > ++func (t *Tree) pipeline(context string, end itemType) (pipe *PipeNode)
> {
> > +       token := t.peekNonSpace()
> > +       pipe = t.newPipeline(token.pos, token.line, nil)
> > +       // Are there declarations or assignments?
> > +@@ -430,12 +447,9 @@ decls:
> > +       }
> > +       for {
> > +               switch token := t.nextNonSpace(); token.typ {
> > +-              case itemRightDelim, itemRightParen:
> > ++              case end:
> > +                       // At this point, the pipeline is complete
> > +                       t.checkPipeline(pipe, context)
> > +-                      if token.typ == itemRightParen {
> > +-                              t.backup()
> > +-                      }
> > +                       return
> > +               case itemBool, itemCharConstant, itemComplex, itemDot,
> itemField, itemIdentifier,
> > +                       itemNumber, itemNil, itemRawString, itemString,
> itemVariable, itemLeftParen:
> > +@@ -464,7 +478,7 @@ func (t *Tree) checkPipeline(pipe *PipeNode,
> context string) {
> > +
> > + func (t *Tree) parseControl(allowElseIf bool, context string) (pos
> Pos, line int, pipe *PipeNode, list, elseList *ListNode) {
> > +       defer t.popVars(len(t.vars))
> > +-      pipe = t.pipeline(context)
> > ++      pipe = t.pipeline(context, itemRightDelim)
> > +       var next Node
> > +       list, next = t.itemList()
> > +       switch next.Type() {
> > +@@ -550,7 +564,7 @@ func (t *Tree) blockControl() Node {
> > +
> > +       token := t.nextNonSpace()
> > +       name := t.parseTemplateName(token, context)
> > +-      pipe := t.pipeline(context)
> > ++      pipe := t.pipeline(context, itemRightDelim)
> > +
> > +       block := New(name) // name will be updated once we know it.
> > +       block.text = t.text
> > +@@ -580,7 +594,7 @@ func (t *Tree) templateControl() Node {
> > +       if t.nextNonSpace().typ != itemRightDelim {
> > +               t.backup()
> > +               // Do not pop variables; they persist until "end".
> > +-              pipe = t.pipeline(context)
> > ++              pipe = t.pipeline(context, itemRightDelim)
> > +       }
> > +       return t.newTemplate(token.pos, token.line, name, pipe)
> > + }
> > +@@ -614,13 +628,12 @@ func (t *Tree) command() *CommandNode {
> > +               switch token := t.next(); token.typ {
> > +               case itemSpace:
> > +                       continue
> > +-              case itemError:
> > +-                      t.errorf("%s", token.val)
> > +               case itemRightDelim, itemRightParen:
> > +                       t.backup()
> > +               case itemPipe:
> > ++                      // nothing here; break loop below
> > +               default:
> > +-                      t.errorf("unexpected %s in operand", token)
> > ++                      t.unexpected(token, "operand")
> > +               }
> > +               break
> > +       }
> > +@@ -675,8 +688,6 @@ func (t *Tree) operand() Node {
> > + // A nil return means the next item is not a term.
> > + func (t *Tree) term() Node {
> > +       switch token := t.nextNonSpace(); token.typ {
> > +-      case itemError:
> > +-              t.errorf("%s", token.val)
> > +       case itemIdentifier:
> > +               if !t.hasFunction(token.val) {
> > +                       t.errorf("function %q not defined", token.val)
> > +@@ -699,11 +710,7 @@ func (t *Tree) term() Node {
> > +               }
> > +               return number
> > +       case itemLeftParen:
> > +-              pipe := t.pipeline("parenthesized pipeline")
> > +-              if token := t.next(); token.typ != itemRightParen {
> > +-                      t.errorf("unclosed right paren: unexpected %s",
> token)
> > +-              }
> > +-              return pipe
> > ++              return t.pipeline("parenthesized pipeline",
> itemRightParen)
> > +       case itemString, itemRawString:
> > +               s, err := strconv.Unquote(token.val)
> > +               if err != nil {
> > +diff --git a/src/text/template/parse/parse_test.go
> b/src/text/template/parse/parse_test.go
> > +index d9c13c5..220f984 100644
> > +--- a/src/text/template/parse/parse_test.go
> > ++++ b/src/text/template/parse/parse_test.go
> > +@@ -250,6 +250,13 @@ var parseTests = []parseTest{
> > +       {"comment trim left and right", "x \r\n\t{{- /* */ -}}\n\n\ty",
> noError, `"x""y"`},
> > +       {"block definition", `{{block "foo" .}}hello{{end}}`, noError,
> > +               `{{template "foo" .}}`},
> > ++
> > ++      {"newline in assignment", "{{ $x \n := \n 1 \n }}", noError,
> "{{$x := 1}}"},
> > ++      {"newline in empty action", "{{\n}}", hasError, "{{\n}}"},
> > ++      {"newline in pipeline", "{{\n\"x\"\n|\nprintf\n}}", noError,
> `{{"x" | printf}}`},
> > ++      {"newline in comment", "{{/*\nhello\n*/}}", noError, ""},
> > ++      {"newline in comment", "{{-\n/*\nhello\n*/\n-}}", noError, ""},
> > ++
> > +       // Errors.
> > +       {"unclosed action", "hello{{range", hasError, ""},
> > +       {"unmatched end", "{{end}}", hasError, ""},
> > +@@ -426,23 +433,38 @@ var errorTests = []parseTest{
> > +       // Check line numbers are accurate.
> > +       {"unclosed1",
> > +               "line1\n{{",
> > +-              hasError, `unclosed1:2: unexpected unclosed action in
> command`},
> > ++              hasError, `unclosed1:2: unclosed action`},
> > +       {"unclosed2",
> > +               "line1\n{{define `x`}}line2\n{{",
> > +-              hasError, `unclosed2:3: unexpected unclosed action in
> command`},
> > ++              hasError, `unclosed2:3: unclosed action`},
> > ++      {"unclosed3",
> > ++              "line1\n{{\"x\"\n\"y\"\n",
> > ++              hasError, `unclosed3:4: unclosed action started at
> unclosed3:2`},
> > ++      {"unclosed4",
> > ++              "{{\n\n\n\n\n",
> > ++              hasError, `unclosed4:6: unclosed action started at
> unclosed4:1`},
> > ++      {"var1",
> > ++              "line1\n{{\nx\n}}",
> > ++              hasError, `var1:3: function "x" not defined`},
> > +       // Specific errors.
> > +       {"function",
> > +               "{{foo}}",
> > +               hasError, `function "foo" not defined`},
> > +-      {"comment",
> > ++      {"comment1",
> > +               "{{/*}}",
> > +-              hasError, `unclosed comment`},
> > ++              hasError, `comment1:1: unclosed comment`},
> > ++      {"comment2",
> > ++              "{{/*\nhello\n}}",
> > ++              hasError, `comment2:1: unclosed comment`},
> > +       {"lparen",
> > +               "{{.X (1 2 3}}",
> > +               hasError, `unclosed left paren`},
> > +       {"rparen",
> > +-              "{{.X 1 2 3)}}",
> > +-              hasError, `unexpected ")"`},
> > ++              "{{.X 1 2 3 ) }}",
> > ++              hasError, `unexpected ")" in command`},
> > ++      {"rparen2",
> > ++              "{{(.X 1 2 3",
> > ++              hasError, `unclosed action`},
> > +       {"space",
> > +               "{{`x`3}}",
> > +               hasError, `in operand`},
> > +@@ -488,7 +510,7 @@ var errorTests = []parseTest{
> > +               hasError, `missing value for parenthesized pipeline`},
> > +       {"multilinerawstring",
> > +               "{{ $v := `\n` }} {{",
> > +-              hasError, `multilinerawstring:2: unexpected unclosed
> action`},
> > ++              hasError, `multilinerawstring:2: unclosed action`},
> > +       {"rangeundefvar",
> > +               "{{range $k}}{{end}}",
> > +               hasError, `undefined variable`},
> > +--
> > +2.7.4
> > diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_5.patch
> b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_5.patch
> > new file mode 100644
> > index 0000000000..fc38929648
> > --- /dev/null
> > +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_5.patch
> > @@ -0,0 +1,585 @@
> > +From e0e6bca6ddc0e6d9fa3a5b644af9b446924fbf83 Mon Sep 17 00:00:00 2001
> > +From: Russ Cox <rsc@golang.org>
> > +Date: Thu, 20 May 2021 12:46:33 -0400
> > +Subject: [PATCH 5/6] html/template, text/template: implement break and
> > + continue for range loops
> > +
> > +Break and continue for range loops was accepted as a proposal in June
> 2017.
> > +It was implemented in CL 66410 (Oct 2017)
> > +but then rolled back in CL 92155 (Feb 2018)
> > +because html/template changes had not been implemented.
> > +
> > +This CL reimplements break and continue in text/template
> > +and then adds support for them in html/template as well.
> > +
> > +Fixes #20531.
> > +
> > +Change-Id: I05330482a976f1c078b4b49c2287bd9031bb7616
> > +Reviewed-on: https://go-review.googlesource.com/c/go/+/321491
> > +Trust: Russ Cox <rsc@golang.org>
> > +Run-TryBot: Russ Cox <rsc@golang.org>
> > +TryBot-Result: Go Bot <gobot@golang.org>
> > +Reviewed-by: Rob Pike <r@golang.org>
> > +
> > +Dependency Patch #5
> > +
> > +Upstream-Status: Backport from
> https://github.com/golang/go/commit/d0dd26a88c019d54f22463daae81e785f5867565
> > +CVE: CVE-2023-24538
> > +Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
> > +---
> > + src/html/template/context.go          |  4 ++
> > + src/html/template/escape.go           | 71
> ++++++++++++++++++++++++++++++++++-
> > + src/html/template/escape_test.go      | 24 ++++++++++++
> > + src/text/template/doc.go              |  8 ++++
> > + src/text/template/exec.go             | 24 +++++++++++-
> > + src/text/template/exec_test.go        |  2 +
> > + src/text/template/parse/lex.go        | 13 ++++++-
> > + src/text/template/parse/lex_test.go   |  2 +
> > + src/text/template/parse/node.go       | 36 ++++++++++++++++++
> > + src/text/template/parse/parse.go      | 42 ++++++++++++++++++++-
> > + src/text/template/parse/parse_test.go |  8 ++++
> > + 11 files changed, 230 insertions(+), 4 deletions(-)
> > +
> > +diff --git a/src/html/template/context.go b/src/html/template/context.go
> > +index f7d4849..aaa7d08 100644
> > +--- a/src/html/template/context.go
> > ++++ b/src/html/template/context.go
> > +@@ -6,6 +6,7 @@ package template
> > +
> > + import (
> > +       "fmt"
> > ++      "text/template/parse"
> > + )
> > +
> > + // context describes the state an HTML parser must be in when it
> reaches the
> > +@@ -22,6 +23,7 @@ type context struct {
> > +       jsCtx   jsCtx
> > +       attr    attr
> > +       element element
> > ++      n       parse.Node // for range break/continue
> > +       err     *Error
> > + }
> > +
> > +@@ -141,6 +143,8 @@ const (
> > +       // stateError is an infectious error state outside any valid
> > +       // HTML/CSS/JS construct.
> > +       stateError
> > ++      // stateDead marks unreachable code after a {{break}} or
> {{continue}}.
> > ++      stateDead
> > + )
> > +
> > + // isComment is true for any state that contains content meant for
> template
> > +diff --git a/src/html/template/escape.go b/src/html/template/escape.go
> > +index 8739735..6dea79c 100644
> > +--- a/src/html/template/escape.go
> > ++++ b/src/html/template/escape.go
> > +@@ -97,6 +97,15 @@ type escaper struct {
> > +       actionNodeEdits   map[*parse.ActionNode][]string
> > +       templateNodeEdits map[*parse.TemplateNode]string
> > +       textNodeEdits     map[*parse.TextNode][]byte
> > ++      // rangeContext holds context about the current range loop.
> > ++      rangeContext *rangeContext
> > ++}
> > ++
> > ++// rangeContext holds information about the current range loop.
> > ++type rangeContext struct {
> > ++      outer     *rangeContext // outer loop
> > ++      breaks    []context     // context at each break action
> > ++      continues []context     // context at each continue action
> > + }
> > +
> > + // makeEscaper creates a blank escaper for the given set.
> > +@@ -109,6 +118,7 @@ func makeEscaper(n *nameSpace) escaper {
> > +               map[*parse.ActionNode][]string{},
> > +               map[*parse.TemplateNode]string{},
> > +               map[*parse.TextNode][]byte{},
> > ++              nil,
> > +       }
> > + }
> > +
> > +@@ -124,8 +134,16 @@ func (e *escaper) escape(c context, n parse.Node)
> context {
> > +       switch n := n.(type) {
> > +       case *parse.ActionNode:
> > +               return e.escapeAction(c, n)
> > ++      case *parse.BreakNode:
> > ++              c.n = n
> > ++              e.rangeContext.breaks = append(e.rangeContext.breaks, c)
> > ++              return context{state: stateDead}
> > +       case *parse.CommentNode:
> > +               return c
> > ++      case *parse.ContinueNode:
> > ++              c.n = n
> > ++              e.rangeContext.continues = append(e.rangeContext.breaks,
> c)
> > ++              return context{state: stateDead}
> > +       case *parse.IfNode:
> > +               return e.escapeBranch(c, &n.BranchNode, "if")
> > +       case *parse.ListNode:
> > +@@ -427,6 +445,12 @@ func join(a, b context, node parse.Node, nodeName
> string) context {
> > +       if b.state == stateError {
> > +               return b
> > +       }
> > ++      if a.state == stateDead {
> > ++              return b
> > ++      }
> > ++      if b.state == stateDead {
> > ++              return a
> > ++      }
> > +       if a.eq(b) {
> > +               return a
> > +       }
> > +@@ -466,14 +490,27 @@ func join(a, b context, node parse.Node, nodeName
> string) context {
> > +
> > + // escapeBranch escapes a branch template node: "if", "range" and
> "with".
> > + func (e *escaper) escapeBranch(c context, n *parse.BranchNode,
> nodeName string) context {
> > ++      if nodeName == "range" {
> > ++              e.rangeContext = &rangeContext{outer: e.rangeContext}
> > ++      }
> > +       c0 := e.escapeList(c, n.List)
> > +-      if nodeName == "range" && c0.state != stateError {
> > ++      if nodeName == "range" {
> > ++              if c0.state != stateError {
> > ++                      c0 = joinRange(c0, e.rangeContext)
> > ++              }
> > ++              e.rangeContext = e.rangeContext.outer
> > ++              if c0.state == stateError {
> > ++                      return c0
> > ++              }
> > ++
> > +               // The "true" branch of a "range" node can execute
> multiple times.
> > +               // We check that executing n.List once results in the
> same context
> > +               // as executing n.List twice.
> > ++              e.rangeContext = &rangeContext{outer: e.rangeContext}
> > +               c1, _ := e.escapeListConditionally(c0, n.List, nil)
> > +               c0 = join(c0, c1, n, nodeName)
> > +               if c0.state == stateError {
> > ++                      e.rangeContext = e.rangeContext.outer
> > +                       // Make clear that this is a problem on loop
> re-entry
> > +                       // since developers tend to overlook that branch
> when
> > +                       // debugging templates.
> > +@@ -481,11 +518,39 @@ func (e *escaper) escapeBranch(c context, n
> *parse.BranchNode, nodeName string)
> > +                       c0.err.Description = "on range loop re-entry: "
> + c0.err.Description
> > +                       return c0
> > +               }
> > ++              c0 = joinRange(c0, e.rangeContext)
> > ++              e.rangeContext = e.rangeContext.outer
> > ++              if c0.state == stateError {
> > ++                      return c0
> > ++              }
> > +       }
> > +       c1 := e.escapeList(c, n.ElseList)
> > +       return join(c0, c1, n, nodeName)
> > + }
> > +
> > ++func joinRange(c0 context, rc *rangeContext) context {
> > ++      // Merge contexts at break and continue statements into overall
> body context.
> > ++      // In theory we could treat breaks differently from continues,
> but for now it is
> > ++      // enough to treat them both as going back to the start of the
> loop (which may then stop).
> > ++      for _, c := range rc.breaks {
> > ++              c0 = join(c0, c, c.n, "range")
> > ++              if c0.state == stateError {
> > ++                      c0.err.Line = c.n.(*parse.BreakNode).Line
> > ++                      c0.err.Description = "at range loop break: " +
> c0.err.Description
> > ++                      return c0
> > ++              }
> > ++      }
> > ++      for _, c := range rc.continues {
> > ++              c0 = join(c0, c, c.n, "range")
> > ++              if c0.state == stateError {
> > ++                      c0.err.Line = c.n.(*parse.ContinueNode).Line
> > ++                      c0.err.Description = "at range loop continue: "
> + c0.err.Description
> > ++                      return c0
> > ++              }
> > ++      }
> > ++      return c0
> > ++}
> > ++
> > + // escapeList escapes a list template node.
> > + func (e *escaper) escapeList(c context, n *parse.ListNode) context {
> > +       if n == nil {
> > +@@ -493,6 +558,9 @@ func (e *escaper) escapeList(c context, n
> *parse.ListNode) context {
> > +       }
> > +       for _, m := range n.Nodes {
> > +               c = e.escape(c, m)
> > ++              if c.state == stateDead {
> > ++                      break
> > ++              }
> > +       }
> > +       return c
> > + }
> > +@@ -503,6 +571,7 @@ func (e *escaper) escapeList(c context, n
> *parse.ListNode) context {
> > + // which is the same as whether e was updated.
> > + func (e *escaper) escapeListConditionally(c context, n
> *parse.ListNode, filter func(*escaper, context) bool) (context, bool) {
> > +       e1 := makeEscaper(e.ns)
> > ++      e1.rangeContext = e.rangeContext
> > +       // Make type inferences available to f.
> > +       for k, v := range e.output {
> > +               e1.output[k] = v
> > +diff --git a/src/html/template/escape_test.go
> b/src/html/template/escape_test.go
> > +index c709660..fa2b84a 100644
> > +--- a/src/html/template/escape_test.go
> > ++++ b/src/html/template/escape_test.go
> > +@@ -920,6 +920,22 @@ func TestErrors(t *testing.T) {
> > +                       "<a href='/foo?{{range
> .Items}}&{{.K}}={{.V}}{{end}}'>",
> > +                       "",
> > +               },
> > ++              {
> > ++                      "{{range .Items}}<a{{if .X}}{{end}}>{{end}}",
> > ++                      "",
> > ++              },
> > ++              {
> > ++                      "{{range .Items}}<a{{if
> .X}}{{end}}>{{continue}}{{end}}",
> > ++                      "",
> > ++              },
> > ++              {
> > ++                      "{{range .Items}}<a{{if
> .X}}{{end}}>{{break}}{{end}}",
> > ++                      "",
> > ++              },
> > ++              {
> > ++                      "{{range .Items}}<a{{if .X}}{{end}}>{{if
> .X}}{{break}}{{end}}{{end}}",
> > ++                      "",
> > ++              },
> > +               // Error cases.
> > +               {
> > +                       "{{if .Cond}}<a{{end}}",
> > +@@ -956,6 +972,14 @@ func TestErrors(t *testing.T) {
> > +                       "z:2:8: on range loop re-entry: {{range}}
> branches",
> > +               },
> > +               {
> > ++                      "{{range .Items}}<a{{if
> .X}}{{break}}{{end}}>{{end}}",
> > ++                      "z:1:29: at range loop break: {{range}} branches
> end in different contexts",
> > ++              },
> > ++              {
> > ++                      "{{range .Items}}<a{{if
> .X}}{{continue}}{{end}}>{{end}}",
> > ++                      "z:1:29: at range loop continue: {{range}}
> branches end in different contexts",
> > ++              },
> > ++              {
> > +                       "<a b=1 c={{.H}}",
> > +                       "z: ends in a non-text context: {stateAttr
> delimSpaceOrTagEnd",
> > +               },
> > +diff --git a/src/text/template/doc.go b/src/text/template/doc.go
> > +index 7b30294..0228b15 100644
> > +--- a/src/text/template/doc.go
> > ++++ b/src/text/template/doc.go
> > +@@ -112,6 +112,14 @@ data, defined in detail in the corresponding
> sections that follow.
> > +               T0 is executed; otherwise, dot is set to the successive
> elements
> > +               of the array, slice, or map and T1 is executed.
> > +
> > ++      {{break}}
> > ++              The innermost {{range pipeline}} loop is ended early,
> stopping the
> > ++              current iteration and bypassing all remaining iterations.
> > ++
> > ++      {{continue}}
> > ++              The current iteration of the innermost {{range
> pipeline}} loop is
> > ++              stopped, and the loop starts the next iteration.
> > ++
> > +       {{template "name"}}
> > +               The template with the specified name is executed with
> nil data.
> > +
> > +diff --git a/src/text/template/exec.go b/src/text/template/exec.go
> > +index 7ac5175..6cb140a 100644
> > +--- a/src/text/template/exec.go
> > ++++ b/src/text/template/exec.go
> > +@@ -5,6 +5,7 @@
> > + package template
> > +
> > + import (
> > ++      "errors"
> > +       "fmt"
> > +       "internal/fmtsort"
> > +       "io"
> > +@@ -244,6 +245,12 @@ func (t *Template) DefinedTemplates() string {
> > +       return b.String()
> > + }
> > +
> > ++// Sentinel errors for use with panic to signal early exits from range
> loops.
> > ++var (
> > ++      walkBreak    = errors.New("break")
> > ++      walkContinue = errors.New("continue")
> > ++)
> > ++
> > + // Walk functions step through the major pieces of the template
> structure,
> > + // generating output as they go.
> > + func (s *state) walk(dot reflect.Value, node parse.Node) {
> > +@@ -256,7 +263,11 @@ func (s *state) walk(dot reflect.Value, node
> parse.Node) {
> > +               if len(node.Pipe.Decl) == 0 {
> > +                       s.printValue(node, val)
> > +               }
> > ++      case *parse.BreakNode:
> > ++              panic(walkBreak)
> > +       case *parse.CommentNode:
> > ++      case *parse.ContinueNode:
> > ++              panic(walkContinue)
> > +       case *parse.IfNode:
> > +               s.walkIfOrWith(parse.NodeIf, dot, node.Pipe, node.List,
> node.ElseList)
> > +       case *parse.ListNode:
> > +@@ -335,6 +346,11 @@ func isTrue(val reflect.Value) (truth, ok bool) {
> > +
> > + func (s *state) walkRange(dot reflect.Value, r *parse.RangeNode) {
> > +       s.at(r)
> > ++      defer func() {
> > ++              if r := recover(); r != nil && r != walkBreak {
> > ++                      panic(r)
> > ++              }
> > ++      }()
> > +       defer s.pop(s.mark())
> > +       val, _ := indirect(s.evalPipeline(dot, r.Pipe))
> > +       // mark top of stack before any variables in the body are pushed.
> > +@@ -348,8 +364,14 @@ func (s *state) walkRange(dot reflect.Value, r
> *parse.RangeNode) {
> > +               if len(r.Pipe.Decl) > 1 {
> > +                       s.setTopVar(2, index)
> > +               }
> > ++              defer s.pop(mark)
> > ++              defer func() {
> > ++                      // Consume panic(walkContinue)
> > ++                      if r := recover(); r != nil && r != walkContinue
> {
> > ++                              panic(r)
> > ++                      }
> > ++              }()
> > +               s.walk(elem, r.List)
> > +-              s.pop(mark)
> > +       }
> > +       switch val.Kind() {
> > +       case reflect.Array, reflect.Slice:
> > +diff --git a/src/text/template/exec_test.go
> b/src/text/template/exec_test.go
> > +index 3309b33..a639f44 100644
> > +--- a/src/text/template/exec_test.go
> > ++++ b/src/text/template/exec_test.go
> > +@@ -563,6 +563,8 @@ var execTests = []execTest{
> > +       {"range empty no else", "{{range .SIEmpty}}-{{.}}-{{end}}", "",
> tVal, true},
> > +       {"range []int else", "{{range .SI}}-{{.}}-{{else}}EMPTY{{end}}",
> "-3--4--5-", tVal, true},
> > +       {"range empty else", "{{range
> .SIEmpty}}-{{.}}-{{else}}EMPTY{{end}}", "EMPTY", tVal, true},
> > ++      {"range []int break else", "{{range
> .SI}}-{{.}}-{{break}}NOTREACHED{{else}}EMPTY{{end}}", "-3-", tVal, true},
> > ++      {"range []int continue else", "{{range
> .SI}}-{{.}}-{{continue}}NOTREACHED{{else}}EMPTY{{end}}", "-3--4--5-", tVal,
> true},
> > +       {"range []bool", "{{range .SB}}-{{.}}-{{end}}", "-true--false-",
> tVal, true},
> > +       {"range []int method", "{{range .SI | .MAdd .I}}-{{.}}-{{end}}",
> "-20--21--22-", tVal, true},
> > +       {"range map", "{{range .MSI}}-{{.}}-{{end}}", "-1--3--2-", tVal,
> true},
> > +diff --git a/src/text/template/parse/lex.go
> b/src/text/template/parse/lex.go
> > +index 6784071..95e3377 100644
> > +--- a/src/text/template/parse/lex.go
> > ++++ b/src/text/template/parse/lex.go
> > +@@ -62,6 +62,8 @@ const (
> > +       // Keywords appear after all the rest.
> > +       itemKeyword  // used only to delimit the keywords
> > +       itemBlock    // block keyword
> > ++      itemBreak    // break keyword
> > ++      itemContinue // continue keyword
> > +       itemDot      // the cursor, spelled '.'
> > +       itemDefine   // define keyword
> > +       itemElse     // else keyword
> > +@@ -76,6 +78,8 @@ const (
> > + var key = map[string]itemType{
> > +       ".":        itemDot,
> > +       "block":    itemBlock,
> > ++      "break":    itemBreak,
> > ++      "continue": itemContinue,
> > +       "define":   itemDefine,
> > +       "else":     itemElse,
> > +       "end":      itemEnd,
> > +@@ -119,6 +123,8 @@ type lexer struct {
> > +       parenDepth  int       // nesting depth of ( ) exprs
> > +       line        int       // 1+number of newlines seen
> > +       startLine   int       // start line of this item
> > ++      breakOK     bool      // break keyword allowed
> > ++      continueOK  bool      // continue keyword allowed
> > + }
> > +
> > + // next returns the next rune in the input.
> > +@@ -461,7 +467,12 @@ Loop:
> > +                       }
> > +                       switch {
> > +                       case key[word] > itemKeyword:
> > +-                              l.emit(key[word])
> > ++                              item := key[word]
> > ++                              if item == itemBreak && !l.breakOK ||
> item == itemContinue && !l.continueOK {
> > ++                                      l.emit(itemIdentifier)
> > ++                              } else {
> > ++                                      l.emit(item)
> > ++                              }
> > +                       case word[0] == '.':
> > +                               l.emit(itemField)
> > +                       case word == "true", word == "false":
> > +diff --git a/src/text/template/parse/lex_test.go
> b/src/text/template/parse/lex_test.go
> > +index 6510eed..df6aabf 100644
> > +--- a/src/text/template/parse/lex_test.go
> > ++++ b/src/text/template/parse/lex_test.go
> > +@@ -35,6 +35,8 @@ var itemName = map[itemType]string{
> > +       // keywords
> > +       itemDot:      ".",
> > +       itemBlock:    "block",
> > ++      itemBreak:    "break",
> > ++      itemContinue: "continue",
> > +       itemDefine:   "define",
> > +       itemElse:     "else",
> > +       itemIf:       "if",
> > +diff --git a/src/text/template/parse/node.go
> b/src/text/template/parse/node.go
> > +index a9dad5e..c398da0 100644
> > +--- a/src/text/template/parse/node.go
> > ++++ b/src/text/template/parse/node.go
> > +@@ -71,6 +71,8 @@ const (
> > +       NodeVariable                   // A $ variable.
> > +       NodeWith                       // A with action.
> > +       NodeComment                    // A comment.
> > ++      NodeBreak                      // A break action.
> > ++      NodeContinue                   // A continue action.
> > + )
> > +
> > + // Nodes.
> > +@@ -907,6 +909,40 @@ func (i *IfNode) Copy() Node {
> > +       return i.tr.newIf(i.Pos, i.Line, i.Pipe.CopyPipe(),
> i.List.CopyList(), i.ElseList.CopyList())
> > + }
> > +
> > ++// BreakNode represents a {{break}} action.
> > ++type BreakNode struct {
> > ++      tr *Tree
> > ++      NodeType
> > ++      Pos
> > ++      Line int
> > ++}
> > ++
> > ++func (t *Tree) newBreak(pos Pos, line int) *BreakNode {
> > ++      return &BreakNode{tr: t, NodeType: NodeBreak, Pos: pos, Line:
> line}
> > ++}
> > ++
> > ++func (b *BreakNode) Copy() Node                  { return
> b.tr.newBreak(b.Pos, b.Line) }
> > ++func (b *BreakNode) String() string              { return "{{break}}" }
> > ++func (b *BreakNode) tree() *Tree                 { return b.tr }
> > ++func (b *BreakNode) writeTo(sb *strings.Builder) {
> sb.WriteString("{{break}}") }
> > ++
> > ++// ContinueNode represents a {{continue}} action.
> > ++type ContinueNode struct {
> > ++      tr *Tree
> > ++      NodeType
> > ++      Pos
> > ++      Line int
> > ++}
> > ++
> > ++func (t *Tree) newContinue(pos Pos, line int) *ContinueNode {
> > ++      return &ContinueNode{tr: t, NodeType: NodeContinue, Pos: pos,
> Line: line}
> > ++}
> > ++
> > ++func (c *ContinueNode) Copy() Node                  { return
> c.tr.newContinue(c.Pos, c.Line) }
> > ++func (c *ContinueNode) String() string              { return
> "{{continue}}" }
> > ++func (c *ContinueNode) tree() *Tree                 { return c.tr }
> > ++func (c *ContinueNode) writeTo(sb *strings.Builder) {
> sb.WriteString("{{continue}}") }
> > ++
> > + // RangeNode represents a {{range}} action and its commands.
> > + type RangeNode struct {
> > +       BranchNode
> > +diff --git a/src/text/template/parse/parse.go
> b/src/text/template/parse/parse.go
> > +index 5e6e512..7f78b56 100644
> > +--- a/src/text/template/parse/parse.go
> > ++++ b/src/text/template/parse/parse.go
> > +@@ -31,6 +31,7 @@ type Tree struct {
> > +       vars       []string // variables defined at the moment.
> > +       treeSet    map[string]*Tree
> > +       actionLine int // line of left delim starting action
> > ++      rangeDepth int
> > +       mode       Mode
> > + }
> > +
> > +@@ -223,6 +224,8 @@ func (t *Tree) startParse(funcs
> []map[string]interface{}, lex *lexer, treeSet ma
> > +       t.vars = []string{"$"}
> > +       t.funcs = funcs
> > +       t.treeSet = treeSet
> > ++      lex.breakOK = !t.hasFunction("break")
> > ++      lex.continueOK = !t.hasFunction("continue")
> > + }
> > +
> > + // stopParse terminates parsing.
> > +@@ -385,6 +388,10 @@ func (t *Tree) action() (n Node) {
> > +       switch token := t.nextNonSpace(); token.typ {
> > +       case itemBlock:
> > +               return t.blockControl()
> > ++      case itemBreak:
> > ++              return t.breakControl(token.pos, token.line)
> > ++      case itemContinue:
> > ++              return t.continueControl(token.pos, token.line)
> > +       case itemElse:
> > +               return t.elseControl()
> > +       case itemEnd:
> > +@@ -404,6 +411,32 @@ func (t *Tree) action() (n Node) {
> > +       return t.newAction(token.pos, token.line, t.pipeline("command",
> itemRightDelim))
> > + }
> > +
> > ++// Break:
> > ++//    {{break}}
> > ++// Break keyword is past.
> > ++func (t *Tree) breakControl(pos Pos, line int) Node {
> > ++      if token := t.next(); token.typ != itemRightDelim {
> > ++              t.unexpected(token, "in {{break}}")
> > ++      }
> > ++      if t.rangeDepth == 0 {
> > ++              t.errorf("{{break}} outside {{range}}")
> > ++      }
> > ++      return t.newBreak(pos, line)
> > ++}
> > ++
> > ++// Continue:
> > ++//    {{continue}}
> > ++// Continue keyword is past.
> > ++func (t *Tree) continueControl(pos Pos, line int) Node {
> > ++      if token := t.next(); token.typ != itemRightDelim {
> > ++              t.unexpected(token, "in {{continue}}")
> > ++      }
> > ++      if t.rangeDepth == 0 {
> > ++              t.errorf("{{continue}} outside {{range}}")
> > ++      }
> > ++      return t.newContinue(pos, line)
> > ++}
> > ++
> > + // Pipeline:
> > + //    declarations? command ('|' command)*
> > + func (t *Tree) pipeline(context string, end itemType) (pipe *PipeNode)
> {
> > +@@ -479,8 +512,14 @@ func (t *Tree) checkPipeline(pipe *PipeNode,
> context string) {
> > + func (t *Tree) parseControl(allowElseIf bool, context string) (pos
> Pos, line int, pipe *PipeNode, list, elseList *ListNode) {
> > +       defer t.popVars(len(t.vars))
> > +       pipe = t.pipeline(context, itemRightDelim)
> > ++      if context == "range" {
> > ++              t.rangeDepth++
> > ++      }
> > +       var next Node
> > +       list, next = t.itemList()
> > ++      if context == "range" {
> > ++              t.rangeDepth--
> > ++      }
> > +       switch next.Type() {
> > +       case nodeEnd: //done
> > +       case nodeElse:
> > +@@ -522,7 +561,8 @@ func (t *Tree) ifControl() Node {
> > + //    {{range pipeline}} itemList {{else}} itemList {{end}}
> > + // Range keyword is past.
> > + func (t *Tree) rangeControl() Node {
> > +-      return t.newRange(t.parseControl(false, "range"))
> > ++      r := t.newRange(t.parseControl(false, "range"))
> > ++      return r
> > + }
> > +
> > + // With:
> > +diff --git a/src/text/template/parse/parse_test.go
> b/src/text/template/parse/parse_test.go
> > +index 220f984..ba45636 100644
> > +--- a/src/text/template/parse/parse_test.go
> > ++++ b/src/text/template/parse/parse_test.go
> > +@@ -230,6 +230,10 @@ var parseTests = []parseTest{
> > +               `{{range $x := .SI}}{{.}}{{end}}`},
> > +       {"range 2 vars", "{{range $x, $y := .SI}}{{.}}{{end}}", noError,
> > +               `{{range $x, $y := .SI}}{{.}}{{end}}`},
> > ++      {"range with break", "{{range .SI}}{{.}}{{break}}{{end}}",
> noError,
> > ++              `{{range .SI}}{{.}}{{break}}{{end}}`},
> > ++      {"range with continue", "{{range .SI}}{{.}}{{continue}}{{end}}",
> noError,
> > ++              `{{range .SI}}{{.}}{{continue}}{{end}}`},
> > +       {"constants", "{{range .SI 1 -3.2i true false 'a' nil}}{{end}}",
> noError,
> > +               `{{range .SI 1 -3.2i true false 'a' nil}}{{end}}`},
> > +       {"template", "{{template `x`}}", noError,
> > +@@ -279,6 +283,10 @@ var parseTests = []parseTest{
> > +       {"adjacent args", "{{printf 3`x`}}", hasError, ""},
> > +       {"adjacent args with .", "{{printf `x`.}}", hasError, ""},
> > +       {"extra end after if", "{{if .X}}a{{else if
> .Y}}b{{end}}{{end}}", hasError, ""},
> > ++      {"break outside range", "{{range .}}{{end}} {{break}}",
> hasError, ""},
> > ++      {"continue outside range", "{{range .}}{{end}} {{continue}}",
> hasError, ""},
> > ++      {"break in range else", "{{range .}}{{else}}{{break}}{{end}}",
> hasError, ""},
> > ++      {"continue in range else", "{{range
> .}}{{else}}{{continue}}{{end}}", hasError, ""},
> > +       // Other kinds of assignments and operators aren't available yet.
> > +       {"bug0a", "{{$x := 0}}{{$x}}", noError, "{{$x := 0}}{{$x}}"},
> > +       {"bug0b", "{{$x += 1}}{{$x}}", hasError, ""},
> > +--
> > +2.7.4
> > diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-3.patch
> b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_6.patch
> > similarity index 53%
> > rename from meta/recipes-devtools/go/go-1.14/CVE-2023-24538-3.patch
> > rename to meta/recipes-devtools/go/go-1.14/CVE-2023-24538_6.patch
> > index d5bb33e091..baf400b891 100644
> > --- a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-3.patch
> > +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_6.patch
> > @@ -1,7 +1,7 @@
> > From 16f4882984569f179d73967c9eee679bb9b098c5 Mon Sep 17 00:00:00 2001
> > From: Roland Shoemaker <bracewell@google.com>
> > Date: Mon, 20 Mar 2023 11:01:13 -0700
> > -Subject: [PATCH 3/3] html/template: disallow actions in JS template
> literals
> > +Subject: [PATCH 6/6] html/template: disallow actions in JS template
> literals
> > 
> > ECMAScript 6 introduced template literals[0][1] which are delimited with
> > backticks. These need to be escaped in a similar fashion to the
> > @@ -52,12 +52,15 @@ CVE: CVE-2023-24538
> > Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
> > ---
> > src/html/template/context.go      |  2 ++
> > - src/html/template/error.go        | 13 +++++++++++++
> > - src/html/template/escape.go       | 11 +++++++++++
> > + src/html/template/error.go        | 13 ++++++++
> > + src/html/template/escape.go       | 11 +++++++
> > + src/html/template/escape_test.go  | 66
> ++++++++++++++++++++++-----------------
> > src/html/template/js.go           |  2 ++
> > - src/html/template/jsctx_string.go |  9 +++++++++
> > - src/html/template/transition.go   |  7 ++++++-
> > - 6 files changed, 43 insertions(+), 1 deletion(-)
> > + src/html/template/js_test.go      |  2 +-
> > + src/html/template/jsctx_string.go |  9 ++++++
> > + src/html/template/state_string.go | 37 ++++++++++++++++++++--
> > + src/html/template/transition.go   |  7 ++++-
> > + 9 files changed, 116 insertions(+), 33 deletions(-)
> > 
> > diff --git a/src/html/template/context.go b/src/html/template/context.go
> > index f7d4849..0b65313 100644
> > @@ -125,6 +128,104 @@ index f12dafa..29ca5b3 100644
> > case stateJSRegexp:
> > s = append(s, "_html_template_jsregexpescaper")
> > case stateCSS:
> > +diff --git a/src/html/template/escape_test.go
> b/src/html/template/escape_test.go
> > +index fa2b84a..1b150e9 100644
> > +--- a/src/html/template/escape_test.go
> > ++++ b/src/html/template/escape_test.go
> > +@@ -681,35 +681,31 @@ func TestEscape(t *testing.T) {
> > +       }
> > +
> > +       for _, test := range tests {
> > +-              tmpl := New(test.name)
> > +-              tmpl = Must(tmpl.Parse(test.input))
> > +-              // Check for bug 6459: Tree field was not set in Parse.
> > +-              if tmpl.Tree != tmpl.text.Tree {
> > +-                      t.Errorf("%s: tree not set properly", test.name)
> > +-                      continue
> > +-              }
> > +-              b := new(bytes.Buffer)
> > +-              if err := tmpl.Execute(b, data); err != nil {
> > +-                      t.Errorf("%s: template execution failed: %s",
> test.name, err)
> > +-                      continue
> > +-              }
> > +-              if w, g := test.output, b.String(); w != g {
> > +-                      t.Errorf("%s: escaped output:
> want\n\t%q\ngot\n\t%q", test.name, w, g)
> > +-                      continue
> > +-              }
> > +-              b.Reset()
> > +-              if err := tmpl.Execute(b, pdata); err != nil {
> > +-                      t.Errorf("%s: template execution failed for
> pointer: %s", test.name, err)
> > +-                      continue
> > +-              }
> > +-              if w, g := test.output, b.String(); w != g {
> > +-                      t.Errorf("%s: escaped output for pointer:
> want\n\t%q\ngot\n\t%q", test.name, w, g)
> > +-                      continue
> > +-              }
> > +-              if tmpl.Tree != tmpl.text.Tree {
> > +-                      t.Errorf("%s: tree mismatch", test.name)
> > +-                      continue
> > +-              }
> > ++              t.Run(test.name, func(t *testing.T) {
> > ++                      tmpl := New(test.name)
> > ++                      tmpl = Must(tmpl.Parse(test.input))
> > ++                      // Check for bug 6459: Tree field was not set in
> Parse.
> > ++                      if tmpl.Tree != tmpl.text.Tree {
> > ++                              t.Fatalf("%s: tree not set properly",
> test.name)
> > ++                      }
> > ++                      b := new(strings.Builder)
> > ++                      if err := tmpl.Execute(b, data); err != nil {
> > ++                              t.Fatalf("%s: template execution failed:
> %s", test.name, err)
> > ++                      }
> > ++                      if w, g := test.output, b.String(); w != g {
> > ++                              t.Fatalf("%s: escaped output:
> want\n\t%q\ngot\n\t%q", test.name, w, g)
> > ++                      }
> > ++                      b.Reset()
> > ++                      if err := tmpl.Execute(b, pdata); err != nil {
> > ++                              t.Fatalf("%s: template execution failed
> for pointer: %s", test.name, err)
> > ++                      }
> > ++                      if w, g := test.output, b.String(); w != g {
> > ++                              t.Fatalf("%s: escaped output for
> pointer: want\n\t%q\ngot\n\t%q", test.name, w, g)
> > ++                      }
> > ++                      if tmpl.Tree != tmpl.text.Tree {
> > ++                              t.Fatalf("%s: tree mismatch", test.name)
> > ++                      }
> > ++              })
> > +       }
> > + }
> > +
> > +@@ -936,6 +932,10 @@ func TestErrors(t *testing.T) {
> > +                       "{{range .Items}}<a{{if .X}}{{end}}>{{if
> .X}}{{break}}{{end}}{{end}}",
> > +                       "",
> > +               },
> > ++              {
> > ++                      "<script>var a = `${a+b}`</script>`",
> > ++                      "",
> > ++              },
> > +               // Error cases.
> > +               {
> > +                       "{{if .Cond}}<a{{end}}",
> > +@@ -1082,6 +1082,10 @@ func TestErrors(t *testing.T) {
> > +                       // html is allowed since it is the last command
> in the pipeline, but urlquery is not.
> > +                       `predefined escaper "urlquery" disallowed in
> template`,
> > +               },
> > ++              {
> > ++                      "<script>var tmpl = `asd {{.}}`;</script>",
> > ++                      `{{.}} appears in a JS template literal`,
> > ++              },
> > +       }
> > +       for _, test := range tests {
> > +               buf := new(bytes.Buffer)
> > +@@ -1304,6 +1308,10 @@ func TestEscapeText(t *testing.T) {
> > +                       context{state: stateJSSqStr, delim:
> delimDoubleQuote, attr: attrScript},
> > +               },
> > +               {
> > ++                      "<a onclick=\"`foo",
> > ++                      context{state: stateJSBqStr, delim:
> delimDoubleQuote, attr: attrScript},
> > ++              },
> > ++              {
> > +                       `<A ONCLICK="'`,
> > +                       context{state: stateJSSqStr, delim:
> delimDoubleQuote, attr: attrScript},
> > +               },
> > diff --git a/src/html/template/js.go b/src/html/template/js.go
> > index ea9c183..b888eaf 100644
> > --- a/src/html/template/js.go
> > @@ -145,6 +246,19 @@ index ea9c183..b888eaf 100644
> > '+':  `\u002b`,
> > '/':  `\/`,
> > '<':  `\u003c`,
> > +diff --git a/src/html/template/js_test.go b/src/html/template/js_test.go
> > +index d7ee47b..7d963ae 100644
> > +--- a/src/html/template/js_test.go
> > ++++ b/src/html/template/js_test.go
> > +@@ -292,7 +292,7 @@ func TestEscapersOnLower7AndSelectHighCodepoints(t
> *testing.T) {
> > +                               `0123456789:;\u003c=\u003e?` +
> > +                               `@ABCDEFGHIJKLMNO` +
> > +                               `PQRSTUVWXYZ[\\]^_` +
> > +-                              "`abcdefghijklmno" +
> > ++                              "\\u0060abcdefghijklmno" +
> > +                               "pqrstuvwxyz{|}~\u007f" +
> > +
> "\u00A0\u0100\\u2028\\u2029\ufeff\U0001D11E",
> > +               },
> > diff --git a/src/html/template/jsctx_string.go
> b/src/html/template/jsctx_string.go
> > index dd1d87e..2394893 100644
> > --- a/src/html/template/jsctx_string.go
> > @@ -165,6 +279,55 @@ index dd1d87e..2394893 100644
> > const _jsCtx_name = "jsCtxRegexpjsCtxDivOpjsCtxUnknown"
> > 
> > var _jsCtx_index = [...]uint8{0, 11, 21, 33}
> > +diff --git a/src/html/template/state_string.go
> b/src/html/template/state_string.go
> > +index 05104be..6fb1a6e 100644
> > +--- a/src/html/template/state_string.go
> > ++++ b/src/html/template/state_string.go
> > +@@ -4,9 +4,42 @@ package template
> > +
> > + import "strconv"
> > +
> > +-const _state_name =
> "stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCDATA \
> stateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSRegexpstateJSBlock \
> CmtstateJSLineCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateError"
> 
> > ++func _() {
> > ++      // An "invalid array index" compiler error signifies that the
> constant values have changed.
> > ++      // Re-run the stringer command to generate them again.
> > ++      var x [1]struct{}
> > ++      _ = x[stateText-0]
> > ++      _ = x[stateTag-1]
> > ++      _ = x[stateAttrName-2]
> > ++      _ = x[stateAfterName-3]
> > ++      _ = x[stateBeforeValue-4]
> > ++      _ = x[stateHTMLCmt-5]
> > ++      _ = x[stateRCDATA-6]
> > ++      _ = x[stateAttr-7]
> > ++      _ = x[stateURL-8]
> > ++      _ = x[stateSrcset-9]
> > ++      _ = x[stateJS-10]
> > ++      _ = x[stateJSDqStr-11]
> > ++      _ = x[stateJSSqStr-12]
> > ++      _ = x[stateJSBqStr-13]
> > ++      _ = x[stateJSRegexp-14]
> > ++      _ = x[stateJSBlockCmt-15]
> > ++      _ = x[stateJSLineCmt-16]
> > ++      _ = x[stateCSS-17]
> > ++      _ = x[stateCSSDqStr-18]
> > ++      _ = x[stateCSSSqStr-19]
> > ++      _ = x[stateCSSDqURL-20]
> > ++      _ = x[stateCSSSqURL-21]
> > ++      _ = x[stateCSSURL-22]
> > ++      _ = x[stateCSSBlockCmt-23]
> > ++      _ = x[stateCSSLineCmt-24]
> > ++      _ = x[stateError-25]
> > ++      _ = x[stateDead-26]
> > ++}
> > ++
> > ++const _state_name =
> "stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCDATA \
> stateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSBqStrstateJSRegexp \
> stateJSBlockCmtstateJSLineCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateErrorstateDead"
> 
> > +
> > +-var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100,
> 111, 118, 130, 142, 155, 170, 184, 192, 205, 218, 231, 244, 255, 271, 286,
> 296}
> > ++var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100,
> 111, 118, 130, 142, 154, 167, 182, 196, 204, 217, 230, 243, 256, 267, 283,
> 298, 308, 317}
> > +
> > + func (i state) String() string {
> > +       if i >= state(len(_state_index)-1) {
> > diff --git a/src/html/template/transition.go
> b/src/html/template/transition.go
> > index 06df679..92eb351 100644
> > --- a/src/html/template/transition.go
> > diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-39318.patch
> b/meta/recipes-devtools/go/go-1.14/CVE-2023-39318.patch
> > index 20e70c0485..00def8fcda 100644
> > --- a/meta/recipes-devtools/go/go-1.14/CVE-2023-39318.patch
> > +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-39318.patch
> > @@ -34,9 +34,9 @@ Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
> > src/html/template/context.go      |  6 ++-
> > src/html/template/escape.go       |  5 +-
> > src/html/template/escape_test.go  | 10 ++++
> > - src/html/template/state_string.go |  4 +-
> > + src/html/template/state_string.go | 26 +++++-----
> > src/html/template/transition.go   | 80 ++++++++++++++++++++-----------
> > - 5 files changed, 72 insertions(+), 33 deletions(-)
> > + 5 files changed, 84 insertions(+), 43 deletions(-)
> > 
> > diff --git a/src/html/template/context.go b/src/html/template/context.go
> > index 0b65313..4eb7891 100644
> > @@ -105,14 +105,38 @@ diff --git a/src/html/template/state_string.go
> b/src/html/template/state_string.
> > index 05104be..b5cfe70 100644
> > --- a/src/html/template/state_string.go
> > +++ b/src/html/template/state_string.go
> > -@@ -4,9 +4,9 @@ package template
> > -
> > - import "strconv"
> > +@@ -25,21 +25,23 @@ func _() {
> > +       _ = x[stateJSRegexp-14]
> > +       _ = x[stateJSBlockCmt-15]
> > +       _ = x[stateJSLineCmt-16]
> > +-      _ = x[stateCSS-17]
> > +-      _ = x[stateCSSDqStr-18]
> > +-      _ = x[stateCSSSqStr-19]
> > +-      _ = x[stateCSSDqURL-20]
> > +-      _ = x[stateCSSSqURL-21]
> > +-      _ = x[stateCSSURL-22]
> > +-      _ = x[stateCSSBlockCmt-23]
> > +-      _ = x[stateCSSLineCmt-24]
> > +-      _ = x[stateError-25]
> > +-      _ = x[stateDead-26]
> > ++      _ = x[stateJSHTMLOpenCmt-17]
> > ++      _ = x[stateJSHTMLCloseCmt-18]
> > ++      _ = x[stateCSS-19]
> > ++      _ = x[stateCSSDqStr-20]
> > ++      _ = x[stateCSSSqStr-21]
> > ++      _ = x[stateCSSDqURL-22]
> > ++      _ = x[stateCSSSqURL-23]
> > ++      _ = x[stateCSSURL-24]
> > ++      _ = x[stateCSSBlockCmt-25]
> > ++      _ = x[stateCSSLineCmt-26]
> > ++      _ = x[stateError-27]
> > ++      _ = x[stateDead-28]
> > + }
> > 
> > --const _state_name =
> "stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCDATA \
> stateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSRegexpstateJSBlock \
> CmtstateJSLineCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateError"
> 
> > +-const _state_name =
> "stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCDATA \
> stateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSBqStrstateJSRegexp \
> stateJSBlockCmtstateJSLineCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateErrorstateDead"
> 
> > +const _state_name =
> "stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCDATA \
> stateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSBqStrstateJSRegexp \
> stateJSBlockCmtstateJSLineCmtstateJSHTMLOpenCmtstateJSHTMLCloseCmtstateCSSstateCSSDq \
> StrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateErrorstateDead"
> 
> > 
> > --var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100,
> 111, 118, 130, 142, 155, 170, 184, 192, 205, 218, 231, 244, 255, 271, 286,
> 296}
> > +-var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100,
> 111, 118, 130, 142, 154, 167, 182, 196, 204, 217, 230, 243, 256, 267, 283,
> 298, 308, 317}
> > +var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100,
> 111, 118, 130, 142, 154, 167, 182, 196, 214, 233, 241, 254, 267, 280, 293,
> 304, 320, 335, 345, 354}
> > 
> > func (i state) String() string {
> > --
> > 2.42.0
> > 
> > 
> > 
> > 
> 


[Attachment #5 (text/html)]

<div dir="ltr">Apologies Steve,<div><br></div><div>I will look into the issue and \
send a new patch for Dunfell. It worked for me on my machine. Maybe something I \
missed.</div><div><br></div><div>Thanks,</div><div>Shubham \
Kulkarni</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On \
Sat, Sep 30, 2023 at 8:02 AM Steve Sakoman &lt;<a \
href="mailto:steve@sakoman.com">steve@sakoman.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">Sorry, this patch doesn&#39;t apply:<br> <br>
Applying: go: Update fix for CVE-2023-24538 &amp; CVE-2023-39318<br>
error: corrupt patch at line 478<br>
error: could not build fake ancestor<br>
Patch failed at 0001 go: Update fix for CVE-2023-24538 &amp; CVE-2023-39318<br>
<br>
Steve<br>
<br>
On Fri, Sep 29, 2023 at 9:21 AM Shubham Kulkarni via<br>
<a href="http://lists.openembedded.org" rel="noreferrer" \
target="_blank">lists.openembedded.org</a> &lt;skulkarni=<a \
href="mailto:mvista.com@lists.openembedded.org" \
target="_blank">mvista.com@lists.openembedded.org</a>&gt;<br> wrote:<br>
&gt;<br>
&gt; From: Shubham Kulkarni &lt;<a href="mailto:skulkarni@mvista.com" \
target="_blank">skulkarni@mvista.com</a>&gt;<br> &gt;<br>
&gt; Add missing files in fix for CVE-2023-24538 &amp; CVE-2023-39318<br>
&gt;<br>
&gt; Upstream Link -<br>
&gt; CVE-2023-24538: <a \
href="https://github.com/golang/go/commit/b1e3ecfa06b67014429a197ec5e134ce4303ad9b" \
rel="noreferrer" target="_blank">https://github.com/golang/go/commit/b1e3ecfa06b67014429a197ec5e134ce4303ad9b</a><br>
 &gt; CVE-2023-39318: <a \
href="https://github.com/golang/go/commit/023b542edf38e2a1f87fcefb9f75ff2f99401b4c" \
rel="noreferrer" target="_blank">https://github.com/golang/go/commit/023b542edf38e2a1f87fcefb9f75ff2f99401b4c</a><br>
 &gt;<br>
&gt; Signed-off-by: Shubham Kulkarni &lt;<a href="mailto:skulkarni@mvista.com" \
target="_blank">skulkarni@mvista.com</a>&gt;<br> &gt; ---<br>
&gt;   meta/recipes-devtools/go/go-1.14.inc               |     5 +-<br>
&gt;   .../go/go-1.14/CVE-2023-24538-1.patch              |     4 +-<br>
&gt;   .../go/go-1.14/CVE-2023-24538-2.patch              | 447 ++++++++++++-<br>
&gt;   .../go/go-1.14/CVE-2023-24538_3.patch              | 393 ++++++++++++<br>
&gt;   .../go/go-1.14/CVE-2023-24538_4.patch              | 497 +++++++++++++++<br>
&gt;   .../go/go-1.14/CVE-2023-24538_5.patch              | 585 \
++++++++++++++++++<br> &gt;   ...3-24538-3.patch =&gt; CVE-2023-24538_6.patch} | 175 \
+++++-<br> &gt;   .../go/go-1.14/CVE-2023-39318.patch                 |   38 +-<br>
&gt;   8 files changed, 2124 insertions(+), 20 deletions(-)<br>
&gt;   create mode 100644 meta/recipes-devtools/go/go-1.14/CVE-2023-24538_3.patch<br>
&gt;   create mode 100644 meta/recipes-devtools/go/go-1.14/CVE-2023-24538_4.patch<br>
&gt;   create mode 100644 meta/recipes-devtools/go/go-1.14/CVE-2023-24538_5.patch<br>
&gt;   rename meta/recipes-devtools/go/go-1.14/{CVE-2023-24538-3.patch =&gt; \
CVE-2023-24538_6.patch} (53%)<br> &gt;<br>
&gt; diff --git a/meta/recipes-devtools/go/go-1.14.inc \
b/meta/recipes-devtools/go/go-1.14.inc<br> &gt; index be63f64825..091b778de8 \
100644<br> &gt; --- a/meta/recipes-devtools/go/go-1.14.inc<br>
&gt; +++ b/meta/recipes-devtools/go/go-1.14.inc<br>
&gt; @@ -60,7 +60,10 @@ SRC_URI += &quot;\<br>
&gt;         file://CVE-2023-24534.patch \<br>
&gt;         file://CVE-2023-24538-1.patch \<br>
&gt;         file://CVE-2023-24538-2.patch \<br>
&gt; -      file://CVE-2023-24538-3.patch \<br>
&gt; +      file://CVE-2023-24538_3.patch \<br>
&gt; +      file://CVE-2023-24538_4.patch \<br>
&gt; +      file://CVE-2023-24538_5.patch \<br>
&gt; +      file://CVE-2023-24538_6.patch \<br>
&gt;         file://CVE-2023-24539.patch \<br>
&gt;         file://CVE-2023-24540.patch \<br>
&gt;         file://CVE-2023-29405-1.patch \<br>
&gt; diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch<br> &gt; index \
eda26e5ff6..23c5075e41 100644<br> &gt; --- \
a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch<br> &gt; +++ \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch<br> &gt; @@ -1,7 +1,7 \
@@<br> &gt;   From 8acd01094d9ee17f6e763a61e49a8a808b3a9ddb Mon Sep 17 00:00:00 \
2001<br> &gt;   From: Brad Fitzpatrick &lt;<a href="mailto:bradfitz@golang.org" \
target="_blank">bradfitz@golang.org</a>&gt;<br> &gt;   Date: Mon, 2 Aug 2021 14:55:51 \
-0700<br> &gt; -Subject: [PATCH 1/3] net/netip: add new IP address package<br>
&gt; +Subject: [PATCH 1/6] net/netip: add new IP address package<br>
&gt;<br>
&gt;   Co-authored-by: Alex Willmer &lt;<a href="mailto:alex@moreati.org.uk" \
target="_blank">alex@moreati.org.uk</a>&gt; (GitHub @moreati)<br> &gt;   \
Co-authored-by: Alexander Yastrebov &lt;<a href="mailto:yastrebov.alex@gmail.com" \
target="_blank">yastrebov.alex@gmail.com</a>&gt;<br> &gt; @@ -31,7 +31,7 @@ Trust: \
Brad Fitzpatrick &lt;<a href="mailto:bradfitz@golang.org" \
target="_blank">bradfitz@golang.org</a>&gt;<br> &gt;<br>
&gt;   Dependency Patch #1<br>
&gt;<br>
&gt; -Upstream-Status: Backport [<a \
href="https://github.com/golang/go/commit/a59e33224e42d60a97fa720a45e1b74eb6aaa3d0" \
rel="noreferrer" target="_blank">https://github.com/golang/go/commit/a59e33224e42d60a97fa720a45e1b74eb6aaa3d0</a>]<br>
 &gt; +Upstream-Status: Backport from <a \
href="https://github.com/golang/go/commit/a59e33224e42d60a97fa720a45e1b74eb6aaa3d0" \
rel="noreferrer" target="_blank">https://github.com/golang/go/commit/a59e33224e42d60a97fa720a45e1b74eb6aaa3d0</a><br>
 &gt;   CVE: CVE-2023-24538<br>
&gt;   Signed-off-by: Shubham Kulkarni &lt;<a href="mailto:skulkarni@mvista.com" \
target="_blank">skulkarni@mvista.com</a>&gt;<br> &gt;   ---<br>
&gt; diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch<br> &gt; index \
5036f2890b..3840617a32 100644<br> &gt; --- \
a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch<br> &gt; +++ \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch<br> &gt; @@ -1,7 +1,7 \
@@<br> &gt;   From 6fc21505614f36178df0dad7034b6b8e3f7588d5 Mon Sep 17 00:00:00 \
2001<br> &gt;   From: empijei &lt;<a href="mailto:robclap8@gmail.com" \
target="_blank">robclap8@gmail.com</a>&gt;<br> &gt;   Date: Fri, 27 Mar 2020 19:27:55 \
+0100<br> &gt; -Subject: [PATCH 2/3] html/template,text/template: switch to Unicode \
escapes<br> &gt; +Subject: [PATCH 2/6] html/template,text/template: switch to Unicode \
escapes<br> &gt;     for JSON compatibility<br>
&gt;   MIME-Version: 1.0<br>
&gt;   Content-Type: text/plain; charset=UTF-8<br>
&gt; @@ -31,10 +31,238 @@ Upstream-Status: Backport from <a \
href="https://github.com/golang/go/commit/d4d298040d072" rel="noreferrer" \
target="_blank">https://github.com/golang/go/commit/d4d298040d072</a><br> &gt;   CVE: \
CVE-2023-24538<br> &gt;   Signed-off-by: Shubham Kulkarni &lt;<a \
href="mailto:skulkarni@mvista.com" target="_blank">skulkarni@mvista.com</a>&gt;<br> \
&gt;   ---<br> &gt; - src/html/template/js.go      | 70 \
+++++++++++++++++++++++++++-------------------<br> &gt; - src/text/template/funcs.go \
|   8 +++---<br> &gt; - 2 files changed, 46 insertions(+), 32 deletions(-)<br>
&gt; + src/html/template/content_test.go   | 70 \
+++++++++++++++++++-------------------<br> &gt; + src/html/template/escape_test.go    \
|   6 ++--<br> &gt; + src/html/template/example_test.go   |   6 ++--<br>
&gt; + src/html/template/js.go                  | 70 \
+++++++++++++++++++++++---------------<br> &gt; + src/html/template/js_test.go        \
| 68 ++++++++++++++++++------------------<br> &gt; + \
src/html/template/template_test.go | 39 +++++++++++++++++++++<br> &gt; + \
src/text/template/exec_test.go        |   6 ++--<br> &gt; + \
src/text/template/funcs.go              |   8 ++---<br> &gt; + 8 files changed, 163 \
insertions(+), 110 deletions(-)<br> &gt;<br>
&gt; +diff --git a/src/html/template/content_test.go \
b/src/html/template/content_test.go<br> &gt; +index 72d56f5..bd86527 100644<br>
&gt; +--- a/src/html/template/content_test.go<br>
&gt; ++++ b/src/html/template/content_test.go<br>
&gt; +@@ -18,7 +18,7 @@ func TestTypedContent(t *testing.T) {<br>
&gt; +                       HTML(`Hello, &lt;b&gt;World&lt;/b&gt; \
&amp;amp;tc!`),<br> &gt; +                       HTMLAttr(` \
dir=&quot;ltr&quot;`),<br> &gt; +                       JS(`c &amp;&amp; \
alert(&quot;Hello, World!&quot;);`),<br> &gt; +-                     JSStr(`Hello, \
World &amp; O&#39;Reilly\x21`),<br> &gt; ++                     JSStr(`Hello, World \
&amp; O&#39;Reilly\u0021`),<br> &gt; +                       \
URL(`greeting=H%69,&amp;addressee=(World)`),<br> &gt; +                       \
Srcset(`greeting=H%69,&amp;addressee=(World) 2x, <a \
href="https://golang.org/favicon.ico" rel="noreferrer" \
target="_blank">https://golang.org/favicon.ico</a> 500.5w`),<br> &gt; +               \
URL(`,foo/,`),<br> &gt; +@@ -70,7 +70,7 @@ func TestTypedContent(t *testing.T) {<br>
&gt; +                                               `Hello, &lt;b&gt;World&lt;/b&gt; \
&amp;amp;tc!`,<br> &gt; +                                               ` \
dir=&amp;#34;ltr&amp;#34;`,<br> &gt; +                                               \
`c &amp;amp;&amp;amp; alert(&amp;#34;Hello, World!&amp;#34;);`,<br> &gt; +-           \
`Hello, World &amp;amp; O&amp;#39;Reilly\x21`,<br> &gt; ++                            \
`Hello, World &amp;amp; O&amp;#39;Reilly\u0021`,<br> &gt; +                           \
`greeting=H%69,&amp;amp;addressee=(World)`,<br> &gt; +                                \
`greeting=H%69,&amp;amp;addressee=(World) 2x, <a \
href="https://golang.org/favicon.ico" rel="noreferrer" \
target="_blank">https://golang.org/favicon.ico</a> 500.5w`,<br> &gt; +                \
`,foo/,`,<br> &gt; +@@ -100,7 +100,7 @@ func TestTypedContent(t *testing.T) {<br>
&gt; +                                               \
`Hello,&amp;#32;World&amp;#32;&amp;amp;tc!`,<br> &gt; +                               \
`&amp;#32;dir&amp;#61;&amp;#34;ltr&amp;#34;`,<br> &gt; +                              \
`c&amp;#32;&amp;amp;&amp;amp;&amp;#32;alert(&amp;#34;Hello,&amp;#32;World!&amp;#34;);`,<br>
 &gt; +-                                             \
`Hello,&amp;#32;World&amp;#32;&amp;amp;&amp;#32;O&amp;#39;Reilly\x21`,<br> &gt; ++    \
`Hello,&amp;#32;World&amp;#32;&amp;amp;&amp;#32;O&amp;#39;Reilly\u0021`,<br> &gt; +   \
`greeting&amp;#61;H%69,&amp;amp;addressee&amp;#61;(World)`,<br> &gt; +                \
`greeting&amp;#61;H%69,&amp;amp;addressee&amp;#61;(World)&amp;#32;2x,&amp;#32;<a \
href="https://golang.org/favicon.ico&amp;#32;500.5w" rel="noreferrer" \
target="_blank">https://golang.org/favicon.ico&amp;#32;500.5w`</a>,<br> &gt; +        \
`,foo/,`,<br> &gt; +@@ -115,7 +115,7 @@ func TestTypedContent(t *testing.T) {<br>
&gt; +                                               `Hello, World &amp;amp;tc!`,<br>
&gt; +                                               ` \
dir=&amp;#34;ltr&amp;#34;`,<br> &gt; +                                               \
`c &amp;amp;&amp;amp; alert(&amp;#34;Hello, World!&amp;#34;);`,<br> &gt; +-           \
`Hello, World &amp;amp; O&amp;#39;Reilly\x21`,<br> &gt; ++                            \
`Hello, World &amp;amp; O&amp;#39;Reilly\u0021`,<br> &gt; +                           \
`greeting=H%69,&amp;amp;addressee=(World)`,<br> &gt; +                                \
`greeting=H%69,&amp;amp;addressee=(World) 2x, <a \
href="https://golang.org/favicon.ico" rel="noreferrer" \
target="_blank">https://golang.org/favicon.ico</a> 500.5w`,<br> &gt; +                \
`,foo/,`,<br> &gt; +@@ -130,7 +130,7 @@ func TestTypedContent(t *testing.T) {<br>
&gt; +                                               `Hello, \
&amp;lt;b&amp;gt;World&amp;lt;/b&amp;gt; &amp;amp;tc!`,<br> &gt; +                    \
` dir=&amp;#34;ltr&amp;#34;`,<br> &gt; +                                              \
`c &amp;amp;&amp;amp; alert(&amp;#34;Hello, World!&amp;#34;);`,<br> &gt; +-           \
`Hello, World &amp;amp; O&amp;#39;Reilly\x21`,<br> &gt; ++                            \
`Hello, World &amp;amp; O&amp;#39;Reilly\u0021`,<br> &gt; +                           \
`greeting=H%69,&amp;amp;addressee=(World)`,<br> &gt; +                                \
`greeting=H%69,&amp;amp;addressee=(World) 2x, <a \
href="https://golang.org/favicon.ico" rel="noreferrer" \
target="_blank">https://golang.org/favicon.ico</a> 500.5w`,<br> &gt; +                \
`,foo/,`,<br> &gt; +@@ -146,7 +146,7 @@ func TestTypedContent(t *testing.T) {<br>
&gt; +                                               // Not escaped.<br>
&gt; +                                               `c &amp;&amp; alert(&quot;Hello, \
World!&quot;);`,<br> &gt; +                                               // Escape \
sequence not over-escaped.<br> &gt; +-                                             \
`&quot;Hello, World &amp; O&#39;Reilly\x21&quot;`,<br> &gt; ++                        \
`&quot;Hello, World &amp; O&#39;Reilly\u0021&quot;`,<br> &gt; +                       \
`&quot;greeting=H%69,\u0026addressee=(World)&quot;`,<br> &gt; +                       \
`&quot;greeting=H%69,\u0026addressee=(World) 2x, <a \
href="https://golang.org/favicon.ico" rel="noreferrer" \
target="_blank">https://golang.org/favicon.ico</a> 500.5w&quot;`,<br> &gt; +          \
`&quot;,foo/,&quot;`,<br> &gt; +@@ -162,7 +162,7 @@ func TestTypedContent(t \
*testing.T) {<br> &gt; +                                               // Not JS \
escaped but HTML escaped.<br> &gt; +                                               `c \
&amp;amp;&amp;amp; alert(&amp;#34;Hello, World!&amp;#34;);`,<br> &gt; +               \
// Escape sequence not over-escaped.<br> &gt; +-                                      \
`&amp;#34;Hello, World &amp;amp; O&amp;#39;Reilly\x21&amp;#34;`,<br> &gt; ++          \
`&amp;#34;Hello, World &amp;amp; O&amp;#39;Reilly\u0021&amp;#34;`,<br> &gt; +         \
`&amp;#34;greeting=H%69,\u0026addressee=(World)&amp;#34;`,<br> &gt; +                 \
`&amp;#34;greeting=H%69,\u0026addressee=(World) 2x, <a \
href="https://golang.org/favicon.ico" rel="noreferrer" \
target="_blank">https://golang.org/favicon.ico</a> 500.5w&amp;#34;`,<br> &gt; +       \
`&amp;#34;,foo/,&amp;#34;`,<br> &gt; +@@ -171,30 +171,30 @@ func TestTypedContent(t \
*testing.T) {<br> &gt; +                       {<br>
&gt; +                                   \
`&lt;script&gt;alert(&quot;{{.}}&quot;)&lt;/script&gt;`,<br> &gt; +                   \
[]string{<br> &gt; +-                                             `\x3cb\x3e \
\x22foo%\x22 O\x27Reilly \x26bar;`,<br> &gt; +-                                       \
`a[href =~ \x22\/\/<a href="http://example.com" rel="noreferrer" \
target="_blank">example.com</a>\x22]#foo`,<br> &gt; +-                                \
`Hello, \x3cb\x3eWorld\x3c\/b\x3e \x26amp;tc!`,<br> &gt; +-                           \
` dir=\x22ltr\x22`,<br> &gt; +-                                             `c \
\x26\x26 alert(\x22Hello, World!\x22);`,<br> &gt; ++                                  \
`\u003cb\u003e \u0022foo%\u0022 O\u0027Reilly \u0026bar;`,<br> &gt; ++                \
`a[href =~ \u0022\/\/<a href="http://example.com" rel="noreferrer" \
target="_blank">example.com</a>\u0022]#foo`,<br> &gt; ++                              \
`Hello, \u003cb\u003eWorld\u003c\/b\u003e \u0026amp;tc!`,<br> &gt; ++                 \
` dir=\u0022ltr\u0022`,<br> &gt; ++                                             `c \
\u0026\u0026 alert(\u0022Hello, World!\u0022);`,<br> &gt; +                           \
// Escape sequence not over-escaped.<br> &gt; +-                                      \
`Hello, World \x26 O\x27Reilly\x21`,<br> &gt; +-                                      \
`greeting=H%69,\x26addressee=(World)`,<br> &gt; +-                                    \
`greeting=H%69,\x26addressee=(World) 2x, https:\/\/<a href="http://golang.org" \
rel="noreferrer" target="_blank">golang.org</a>\/favicon.ico 500.5w`,<br> &gt; ++     \
`Hello, World \u0026 O\u0027Reilly\u0021`,<br> &gt; ++                                \
`greeting=H%69,\u0026addressee=(World)`,<br> &gt; ++                                  \
`greeting=H%69,\u0026addressee=(World) 2x, https:\/\/<a href="http://golang.org" \
rel="noreferrer" target="_blank">golang.org</a>\/favicon.ico 500.5w`,<br> &gt; +      \
`,foo\/,`,<br> &gt; +                                   },<br>
&gt; +                       },<br>
&gt; +                       {<br>
&gt; +                                   `&lt;script \
type=&quot;text/javascript&quot;&gt;alert(&quot;{{.}}&quot;)&lt;/script&gt;`,<br> \
&gt; +                                   []string{<br> &gt; +-                        \
`\x3cb\x3e \x22foo%\x22 O\x27Reilly \x26bar;`,<br> &gt; +-                            \
`a[href =~ \x22\/\/<a href="http://example.com" rel="noreferrer" \
target="_blank">example.com</a>\x22]#foo`,<br> &gt; +-                                \
`Hello, \x3cb\x3eWorld\x3c\/b\x3e \x26amp;tc!`,<br> &gt; +-                           \
` dir=\x22ltr\x22`,<br> &gt; +-                                             `c \
\x26\x26 alert(\x22Hello, World!\x22);`,<br> &gt; ++                                  \
`\u003cb\u003e \u0022foo%\u0022 O\u0027Reilly \u0026bar;`,<br> &gt; ++                \
`a[href =~ \u0022\/\/<a href="http://example.com" rel="noreferrer" \
target="_blank">example.com</a>\u0022]#foo`,<br> &gt; ++                              \
`Hello, \u003cb\u003eWorld\u003c\/b\u003e \u0026amp;tc!`,<br> &gt; ++                 \
` dir=\u0022ltr\u0022`,<br> &gt; ++                                             `c \
\u0026\u0026 alert(\u0022Hello, World!\u0022);`,<br> &gt; +                           \
// Escape sequence not over-escaped.<br> &gt; +-                                      \
`Hello, World \x26 O\x27Reilly\x21`,<br> &gt; +-                                      \
`greeting=H%69,\x26addressee=(World)`,<br> &gt; +-                                    \
`greeting=H%69,\x26addressee=(World) 2x, https:\/\/<a href="http://golang.org" \
rel="noreferrer" target="_blank">golang.org</a>\/favicon.ico 500.5w`,<br> &gt; ++     \
`Hello, World \u0026 O\u0027Reilly\u0021`,<br> &gt; ++                                \
`greeting=H%69,\u0026addressee=(World)`,<br> &gt; ++                                  \
`greeting=H%69,\u0026addressee=(World) 2x, https:\/\/<a href="http://golang.org" \
rel="noreferrer" target="_blank">golang.org</a>\/favicon.ico 500.5w`,<br> &gt; +      \
`,foo\/,`,<br> &gt; +                                   },<br>
&gt; +                       },<br>
&gt; +@@ -208,7 +208,7 @@ func TestTypedContent(t *testing.T) {<br>
&gt; +                                               // Not escaped.<br>
&gt; +                                               `c &amp;&amp; alert(&quot;Hello, \
World!&quot;);`,<br> &gt; +                                               // Escape \
sequence not over-escaped.<br> &gt; +-                                             \
`&quot;Hello, World &amp; O&#39;Reilly\x21&quot;`,<br> &gt; ++                        \
`&quot;Hello, World &amp; O&#39;Reilly\u0021&quot;`,<br> &gt; +                       \
`&quot;greeting=H%69,\u0026addressee=(World)&quot;`,<br> &gt; +                       \
`&quot;greeting=H%69,\u0026addressee=(World) 2x, <a \
href="https://golang.org/favicon.ico" rel="noreferrer" \
target="_blank">https://golang.org/favicon.ico</a> 500.5w&quot;`,<br> &gt; +          \
`&quot;,foo/,&quot;`,<br> &gt; +@@ -224,7 +224,7 @@ func TestTypedContent(t \
*testing.T) {<br> &gt; +                                               `Hello, \
&lt;b&gt;World&lt;/b&gt; &amp;amp;tc!`,<br> &gt; +                                    \
` dir=&amp;#34;ltr&amp;#34;`,<br> &gt; +                                              \
`c &amp;amp;&amp;amp; alert(&amp;#34;Hello, World!&amp;#34;);`,<br> &gt; +-           \
`Hello, World &amp;amp; O&amp;#39;Reilly\x21`,<br> &gt; ++                            \
`Hello, World &amp;amp; O&amp;#39;Reilly\u0021`,<br> &gt; +                           \
`greeting=H%69,&amp;amp;addressee=(World)`,<br> &gt; +                                \
`greeting=H%69,&amp;amp;addressee=(World) 2x, <a \
href="https://golang.org/favicon.ico" rel="noreferrer" \
target="_blank">https://golang.org/favicon.ico</a> 500.5w`,<br> &gt; +                \
`,foo/,`,<br> &gt; +@@ -233,15 +233,15 @@ func TestTypedContent(t *testing.T) {<br>
&gt; +                       {<br>
&gt; +                                   `&lt;button \
onclick=&#39;alert(&quot;{{.}}&quot;)&#39;&gt;`,<br> &gt; +                           \
[]string{<br> &gt; +-                                             `\x3cb\x3e \
\x22foo%\x22 O\x27Reilly \x26bar;`,<br> &gt; +-                                       \
`a[href =~ \x22\/\/<a href="http://example.com" rel="noreferrer" \
target="_blank">example.com</a>\x22]#foo`,<br> &gt; +-                                \
`Hello, \x3cb\x3eWorld\x3c\/b\x3e \x26amp;tc!`,<br> &gt; +-                           \
` dir=\x22ltr\x22`,<br> &gt; +-                                             `c \
\x26\x26 alert(\x22Hello, World!\x22);`,<br> &gt; ++                                  \
`\u003cb\u003e \u0022foo%\u0022 O\u0027Reilly \u0026bar;`,<br> &gt; ++                \
`a[href =~ \u0022\/\/<a href="http://example.com" rel="noreferrer" \
target="_blank">example.com</a>\u0022]#foo`,<br> &gt; ++                              \
`Hello, \u003cb\u003eWorld\u003c\/b\u003e \u0026amp;tc!`,<br> &gt; ++                 \
` dir=\u0022ltr\u0022`,<br> &gt; ++                                             `c \
\u0026\u0026 alert(\u0022Hello, World!\u0022);`,<br> &gt; +                           \
// Escape sequence not over-escaped.<br> &gt; +-                                      \
`Hello, World \x26 O\x27Reilly\x21`,<br> &gt; +-                                      \
`greeting=H%69,\x26addressee=(World)`,<br> &gt; +-                                    \
`greeting=H%69,\x26addressee=(World) 2x, https:\/\/<a href="http://golang.org" \
rel="noreferrer" target="_blank">golang.org</a>\/favicon.ico 500.5w`,<br> &gt; ++     \
`Hello, World \u0026 O\u0027Reilly\u0021`,<br> &gt; ++                                \
`greeting=H%69,\u0026addressee=(World)`,<br> &gt; ++                                  \
`greeting=H%69,\u0026addressee=(World) 2x, https:\/\/<a href="http://golang.org" \
rel="noreferrer" target="_blank">golang.org</a>\/favicon.ico 500.5w`,<br> &gt; +      \
`,foo\/,`,<br> &gt; +                                   },<br>
&gt; +                       },<br>
&gt; +@@ -253,7 +253,7 @@ func TestTypedContent(t *testing.T) {<br>
&gt; +                                               \
`Hello%2c%20%3cb%3eWorld%3c%2fb%3e%20%26amp%3btc%21`,<br> &gt; +                      \
`%20dir%3d%22ltr%22`,<br> &gt; +                                               \
`c%20%26%26%20alert%28%22Hello%2c%20World%21%22%29%3b`,<br> &gt; +-                   \
`Hello%2c%20World%20%26%20O%27Reilly%5cx21`,<br> &gt; ++                              \
`Hello%2c%20World%20%26%20O%27Reilly%5cu0021`,<br> &gt; +                             \
// Quotes and parens are escaped but %69 is not over-escaped. HTML escaping is \
done.<br> &gt; +                                               \
`greeting=H%69,&amp;amp;addressee=%28World%29`,<br> &gt; +                            \
`greeting%3dH%2569%2c%26addressee%3d%28World%29%202x%2c%20https%3a%2f%<a \
href="http://2fgolang.org" rel="noreferrer" \
target="_blank">2fgolang.org</a>%2ffavicon.ico%20500.5w`,<br> &gt; +@@ -268,7 +268,7 \
@@ func TestTypedContent(t *testing.T) {<br> &gt; +                                   \
`Hello%2c%20%3cb%3eWorld%3c%2fb%3e%20%26amp%3btc%21`,<br> &gt; +                      \
`%20dir%3d%22ltr%22`,<br> &gt; +                                               \
`c%20%26%26%20alert%28%22Hello%2c%20World%21%22%29%3b`,<br> &gt; +-                   \
`Hello%2c%20World%20%26%20O%27Reilly%5cx21`,<br> &gt; ++                              \
`Hello%2c%20World%20%26%20O%27Reilly%5cu0021`,<br> &gt; +                             \
// Quotes and parens are escaped but %69 is not over-escaped. HTML escaping is not \
done.<br> &gt; +                                               \
`greeting=H%69,&amp;addressee=%28World%29`,<br> &gt; +                                \
`greeting%3dH%2569%2c%26addressee%3d%28World%29%202x%2c%20https%3a%2f%<a \
href="http://2fgolang.org" rel="noreferrer" \
target="_blank">2fgolang.org</a>%2ffavicon.ico%20500.5w`,<br> &gt; +diff --git \
a/src/html/template/escape_test.go b/src/html/template/escape_test.go<br> &gt; +index \
e72a9ba..c709660 100644<br> &gt; +--- a/src/html/template/escape_test.go<br>
&gt; ++++ b/src/html/template/escape_test.go<br>
&gt; +@@ -238,7 +238,7 @@ func TestEscape(t *testing.T) {<br>
&gt; +                       {<br>
&gt; +                                   &quot;jsStr&quot;,<br>
&gt; +                                   &quot;&lt;button \
onclick=&#39;alert(&amp;quot;{{.H}}&amp;quot;)&#39;&gt;&quot;,<br> &gt; +-            \
`&lt;button onclick=&#39;alert(&amp;quot;\x3cHello\x3e&amp;quot;)&#39;&gt;`,<br> &gt; \
++                                 `&lt;button \
onclick=&#39;alert(&amp;quot;\u003cHello\u003e&amp;quot;)&#39;&gt;`,<br> &gt; +       \
},<br> &gt; +                       {<br>
&gt; +                                   &quot;badMarshaler&quot;,<br>
&gt; +@@ -259,7 +259,7 @@ func TestEscape(t *testing.T) {<br>
&gt; +                       {<br>
&gt; +                                   &quot;jsRe&quot;,<br>
&gt; +                                   `&lt;button \
onclick=&#39;alert(/{{&quot;foo+bar&quot;}}/.test(&quot;&quot;))&#39;&gt;`,<br> &gt; \
+-                                 `&lt;button \
onclick=&#39;alert(/foo\x2bbar/.test(&quot;&quot;))&#39;&gt;`,<br> &gt; ++            \
`&lt;button onclick=&#39;alert(/foo\u002bbar/.test(&quot;&quot;))&#39;&gt;`,<br> &gt; \
+                       },<br> &gt; +                       {<br>
&gt; +                                   &quot;jsReBlank&quot;,<br>
&gt; +@@ -825,7 +825,7 @@ func TestEscapeSet(t *testing.T) {<br>
&gt; +                                               &quot;main&quot;:     \
`&lt;button onclick=&quot;title=&#39;{{template &quot;helper&quot;}}&#39;; \
...&quot;&gt;{{template &quot;helper&quot;}}&lt;/button&gt;`,<br> &gt; +              \
&quot;helper&quot;: `{{11}} of {{&quot;&lt;100&gt;&quot;}}`,<br> &gt; +               \
},<br> &gt; +-                                 `&lt;button \
onclick=&quot;title=&#39;11 of \x3c100\x3e&#39;; ...&quot;&gt;11 of \
&amp;lt;100&amp;gt;&lt;/button&gt;`,<br> &gt; ++                                 \
`&lt;button onclick=&quot;title=&#39;11 of \u003c100\u003e&#39;; ...&quot;&gt;11 of \
&amp;lt;100&amp;gt;&lt;/button&gt;`,<br> &gt; +                       },<br>
&gt; +                       // A non-recursive template that ends in a different \
context.<br> &gt; +                       // helper starts in jsCtxRegexp and ends in \
jsCtxDivOp.<br> &gt; +diff --git a/src/html/template/example_test.go \
b/src/html/template/example_test.go<br> &gt; +index 9d965f1..6cf936f 100644<br>
&gt; +--- a/src/html/template/example_test.go<br>
&gt; ++++ b/src/html/template/example_test.go<br>
&gt; +@@ -116,9 +116,9 @@ func Example_escape() {<br>
&gt; +           // &amp;#34;Fran &amp;amp; Freddie&amp;#39;s Diner&amp;#34; &amp;<a \
href="mailto:lt%3Btasty@example.com" \
target="_blank">lt;tasty@example.com</a>&amp;gt;<br> &gt; +           // \
&amp;#34;Fran &amp;amp; Freddie&amp;#39;s Diner&amp;#34; &amp;<a \
href="mailto:lt%3Btasty@example.com" \
target="_blank">lt;tasty@example.com</a>&amp;gt;<br> &gt; +           // \
&amp;#34;Fran &amp;amp; Freddie&amp;#39;s Diner&amp;#<a \
href="mailto:34%3B32%26lt%3Btasty@example.com" \
target="_blank">34;32&amp;lt;tasty@example.com</a>&amp;gt;<br> &gt; +-         // \
\&quot;Fran \x26 Freddie\&#39;s Diner\&quot; \<a href="mailto:x3Ctasty@example.com" \
target="_blank">x3Ctasty@example.com</a>\x3E<br> &gt; +-         // \&quot;Fran \x26 \
Freddie\&#39;s Diner\&quot; \<a href="mailto:x3Ctasty@example.com" \
target="_blank">x3Ctasty@example.com</a>\x3E<br> &gt; +-         // \&quot;Fran \x26 \
Freddie\&#39;s Diner\&quot;32\<a href="mailto:x3Ctasty@example.com" \
target="_blank">x3Ctasty@example.com</a>\x3E<br> &gt; ++         // \&quot;Fran \
\u0026 Freddie\&#39;s Diner\&quot; \<a href="mailto:u003Ctasty@example.com" \
target="_blank">u003Ctasty@example.com</a>\u003E<br> &gt; ++         // \&quot;Fran \
\u0026 Freddie\&#39;s Diner\&quot; \<a href="mailto:u003Ctasty@example.com" \
target="_blank">u003Ctasty@example.com</a>\u003E<br> &gt; ++         // \&quot;Fran \
\u0026 Freddie\&#39;s Diner\&quot;32\<a href="mailto:u003Ctasty@example.com" \
target="_blank">u003Ctasty@example.com</a>\u003E<br> &gt; +           // \
%22Fran+%26+Freddie%27s+Diner%2232%3Ctasty%<a href="http://40example.com" \
rel="noreferrer" target="_blank">40example.com</a>%3E<br> &gt; +<br>
&gt; + }<br>
&gt;   diff --git a/src/html/template/js.go b/src/html/template/js.go<br>
&gt;   index 0e91458..ea9c183 100644<br>
&gt;   --- a/src/html/template/js.go<br>
&gt; @@ -173,6 +401,217 @@ index 0e91458..ea9c183 100644<br>
&gt;              &#39;?&#39;:   `\?`,<br>
&gt;              &#39;[&#39;:   `\[`,<br>
&gt;              &#39;\\&#39;: `\\`,<br>
&gt; +diff --git a/src/html/template/js_test.go b/src/html/template/js_test.go<br>
&gt; +index 075adaa..d7ee47b 100644<br>
&gt; +--- a/src/html/template/js_test.go<br>
&gt; ++++ b/src/html/template/js_test.go<br>
&gt; +@@ -137,7 +137,7 @@ func TestJSValEscaper(t *testing.T) {<br>
&gt; +                       {&quot;foo&quot;, `&quot;foo&quot;`},<br>
&gt; +                       // Newlines.<br>
&gt; +                       {&quot;\r\n\u2028\u2029&quot;, \
`&quot;\r\n\u2028\u2029&quot;`},<br> &gt; +-                     // &quot;\v&quot; == \
&quot;v&quot; on IE 6 so use &quot;\x0b&quot; instead.<br> &gt; ++                    \
// &quot;\v&quot; == &quot;v&quot; on IE 6 so use &quot;\u000b&quot; instead.<br> \
&gt; +                       {&quot;\t\x0b&quot;, `&quot;\t\u000b&quot;`},<br> &gt; + \
{struct{ X, Y int }{1, 2}, `{&quot;X&quot;:1,&quot;Y&quot;:2}`},<br> &gt; +           \
{[]interface{}{}, &quot;[]&quot;},<br> &gt; +@@ -173,7 +173,7 @@ func \
TestJSStrEscaper(t *testing.T) {<br> &gt; +           }{<br>
&gt; +                       {&quot;&quot;, ``},<br>
&gt; +                       {&quot;foo&quot;, `foo`},<br>
&gt; +-                     {&quot;\u0000&quot;, `\0`},<br>
&gt; ++                     {&quot;\u0000&quot;, `\u0000`},<br>
&gt; +                       {&quot;\t&quot;, `\t`},<br>
&gt; +                       {&quot;\n&quot;, `\n`},<br>
&gt; +                       {&quot;\r&quot;, `\r`},<br>
&gt; +@@ -183,14 +183,14 @@ func TestJSStrEscaper(t *testing.T) {<br>
&gt; +                       {&quot;\\n&quot;, `\\n`},<br>
&gt; +                       {&quot;foo\r\nbar&quot;, `foo\r\nbar`},<br>
&gt; +                       // Preserve attribute boundaries.<br>
&gt; +-                     {`&quot;`, `\x22`},<br>
&gt; +-                     {`&#39;`, `\x27`},<br>
&gt; ++                     {`&quot;`, `\u0022`},<br>
&gt; ++                     {`&#39;`, `\u0027`},<br>
&gt; +                       // Allow embedding in HTML without further escaping.<br>
&gt; +-                     {`&amp;amp;`, `\x26amp;`},<br>
&gt; ++                     {`&amp;amp;`, `\u0026amp;`},<br>
&gt; +                       // Prevent breaking out of text node and element \
boundaries.<br> &gt; +-                     {&quot;&lt;/script&gt;&quot;, \
`\x3c\/script\x3e`},<br> &gt; +-                     {&quot;&lt;![CDATA[&quot;, \
`\x3c![CDATA[`},<br> &gt; +-                     {&quot;]]&gt;&quot;, `]]\x3e`},<br>
&gt; ++                     {&quot;&lt;/script&gt;&quot;, \
`\u003c\/script\u003e`},<br> &gt; ++                     {&quot;&lt;![CDATA[&quot;, \
`\u003c![CDATA[`},<br> &gt; ++                     {&quot;]]&gt;&quot;, \
`]]\u003e`},<br> &gt; +                       // <a \
href="https://dev.w3.org/html5/markup/aria/syntax.html#escaping-text-span" \
rel="noreferrer" target="_blank">https://dev.w3.org/html5/markup/aria/syntax.html#escaping-text-span</a><br>
 &gt; +                       //     &quot;The text in style, script, title, and \
textarea elements<br> &gt; +                       //     must not have an escaping \
text span start that is not<br> &gt; +@@ -201,11 +201,11 @@ func TestJSStrEscaper(t \
*testing.T) {<br> &gt; +                       // allow regular text content to be \
interpreted as script<br> &gt; +                       // allowing script execution \
via a combination of a JS string<br> &gt; +                       // injection \
followed by an HTML text injection.<br> &gt; +-                     \
{&quot;&lt;!--&quot;, `\x3c!--`},<br> &gt; +-                     \
{&quot;--&gt;&quot;, `--\x3e`},<br> &gt; ++                     {&quot;&lt;!--&quot;, \
`\u003c!--`},<br> &gt; ++                     {&quot;--&gt;&quot;, `--\u003e`},<br>
&gt; +                       // From <a \
href="https://code.google.com/p/doctype/wiki/ArticleUtf7" rel="noreferrer" \
target="_blank">https://code.google.com/p/doctype/wiki/ArticleUtf7</a><br> &gt; +     \
{&quot;+ADw-script+AD4-alert(1)+ADw-/script+AD4-&quot;,<br> &gt; +-                   \
`\x2bADw-script\x2bAD4-alert(1)\x2bADw-\/script\x2bAD4-`,<br> &gt; ++                 \
`\u002bADw-script\u002bAD4-alert(1)\u002bADw-\/script\u002bAD4-`,<br> &gt; +          \
},<br> &gt; +                       // Invalid UTF-8 sequence<br>
&gt; +                       {&quot;foo\xA0bar&quot;, &quot;foo\xA0bar&quot;},<br>
&gt; +@@ -228,7 +228,7 @@ func TestJSRegexpEscaper(t *testing.T) {<br>
&gt; +           }{<br>
&gt; +                       {&quot;&quot;, `(?:)`},<br>
&gt; +                       {&quot;foo&quot;, `foo`},<br>
&gt; +-                     {&quot;\u0000&quot;, `\0`},<br>
&gt; ++                     {&quot;\u0000&quot;, `\u0000`},<br>
&gt; +                       {&quot;\t&quot;, `\t`},<br>
&gt; +                       {&quot;\n&quot;, `\n`},<br>
&gt; +                       {&quot;\r&quot;, `\r`},<br>
&gt; +@@ -238,19 +238,19 @@ func TestJSRegexpEscaper(t *testing.T) {<br>
&gt; +                       {&quot;\\n&quot;, `\\n`},<br>
&gt; +                       {&quot;foo\r\nbar&quot;, `foo\r\nbar`},<br>
&gt; +                       // Preserve attribute boundaries.<br>
&gt; +-                     {`&quot;`, `\x22`},<br>
&gt; +-                     {`&#39;`, `\x27`},<br>
&gt; ++                     {`&quot;`, `\u0022`},<br>
&gt; ++                     {`&#39;`, `\u0027`},<br>
&gt; +                       // Allow embedding in HTML without further escaping.<br>
&gt; +-                     {`&amp;amp;`, `\x26amp;`},<br>
&gt; ++                     {`&amp;amp;`, `\u0026amp;`},<br>
&gt; +                       // Prevent breaking out of text node and element \
boundaries.<br> &gt; +-                     {&quot;&lt;/script&gt;&quot;, \
`\x3c\/script\x3e`},<br> &gt; +-                     {&quot;&lt;![CDATA[&quot;, \
`\x3c!\[CDATA\[`},<br> &gt; +-                     {&quot;]]&gt;&quot;, \
`\]\]\x3e`},<br> &gt; ++                     {&quot;&lt;/script&gt;&quot;, \
`\u003c\/script\u003e`},<br> &gt; ++                     {&quot;&lt;![CDATA[&quot;, \
`\u003c!\[CDATA\[`},<br> &gt; ++                     {&quot;]]&gt;&quot;, \
`\]\]\u003e`},<br> &gt; +                       // Escaping text spans.<br>
&gt; +-                     {&quot;&lt;!--&quot;, `\x3c!\-\-`},<br>
&gt; +-                     {&quot;--&gt;&quot;, `\-\-\x3e`},<br>
&gt; ++                     {&quot;&lt;!--&quot;, `\u003c!\-\-`},<br>
&gt; ++                     {&quot;--&gt;&quot;, `\-\-\u003e`},<br>
&gt; +                       {&quot;*&quot;, `\*`},<br>
&gt; +-                     {&quot;+&quot;, `\x2b`},<br>
&gt; ++                     {&quot;+&quot;, `\u002b`},<br>
&gt; +                       {&quot;?&quot;, `\?`},<br>
&gt; +                       {&quot;[](){}&quot;, `\[\]\(\)\{\}`},<br>
&gt; +                       {&quot;$foo|x.y&quot;, `\$foo\|x\.y`},<br>
&gt; +@@ -284,27 +284,27 @@ func TestEscapersOnLower7AndSelectHighCodepoints(t \
*testing.T) {<br> &gt; +                       {<br>
&gt; +                                   &quot;jsStrEscaper&quot;,<br>
&gt; +                                   jsStrEscaper,<br>
&gt; +-                                 &quot;\\0\x01\x02\x03\x04\x05\x06\x07&quot; \
+<br> &gt; +-                                             \
&quot;\x08\\t\\n\\x0b\\f\\r\x0E\x0F&quot; +<br> &gt; +-                               \
&quot;\x10\x11\x12\x13\x14\x15\x16\x17&quot; +<br> &gt; +-                            \
&quot;\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f&quot; +<br> &gt; +-                            \
` !\x22#$%\x26\x27()*\x2b,-.\/` +<br> &gt; +-                                         \
`0123456789:;\x3c=\x3e?` +<br> &gt; ++                                 \
`\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007` +<br> &gt; ++                      \
`\u0008\t\n\u000b\f\r\u000e\u000f` +<br> &gt; ++                                      \
`\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017` +<br> &gt; ++                      \
`\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f` +<br> &gt; ++                      \
` !\u0022#$%\u0026\u0027()*\u002b,-.\/` +<br> &gt; ++                                 \
`0123456789:;\u003c=\u003e?` +<br> &gt; +                                             \
`@ABCDEFGHIJKLMNO` +<br> &gt; +                                               \
`PQRSTUVWXYZ[\\]^_` +<br> &gt; +                                               \
&quot;`abcdefghijklmno&quot; +<br> &gt; +-                                            \
&quot;pqrstuvwxyz{|}~\x7f&quot; +<br> &gt; ++                                         \
&quot;pqrstuvwxyz{|}~\u007f&quot; +<br> &gt; +                                        \
&quot;\u00A0\u0100\\u2028\\u2029\ufeff\U0001D11E&quot;,<br> &gt; +                    \
},<br> &gt; +                       {<br>
&gt; +                                   &quot;jsRegexpEscaper&quot;,<br>
&gt; +                                   jsRegexpEscaper,<br>
&gt; +-                                 &quot;\\0\x01\x02\x03\x04\x05\x06\x07&quot; \
+<br> &gt; +-                                             \
&quot;\x08\\t\\n\\x0b\\f\\r\x0E\x0F&quot; +<br> &gt; +-                               \
&quot;\x10\x11\x12\x13\x14\x15\x16\x17&quot; +<br> &gt; +-                            \
&quot;\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f&quot; +<br> &gt; +-                            \
` !\x22#\$%\x26\x27\(\)\*\x2b,\-\.\/` +<br> &gt; +-                                   \
`0123456789:;\x3c=\x3e\?` +<br> &gt; ++                                 \
`\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007` +<br> &gt; ++                      \
`\u0008\t\n\u000b\f\r\u000e\u000f` +<br> &gt; ++                                      \
`\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017` +<br> &gt; ++                      \
`\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f` +<br> &gt; ++                      \
` !\u0022#\$%\u0026\u0027\(\)\*\u002b,\-\.\/` +<br> &gt; ++                           \
`0123456789:;\u003c=\u003e\?` +<br> &gt; +                                            \
`@ABCDEFGHIJKLMNO` +<br> &gt; +                                               \
`PQRSTUVWXYZ\[\\\]\^_` +<br> &gt; +                                               \
&quot;`abcdefghijklmno&quot; +<br> &gt; +diff --git \
a/src/html/template/template_test.go b/src/html/template/template_test.go<br> &gt; \
+index 13e6ba4..86bd4db 100644<br> &gt; +--- a/src/html/template/template_test.go<br>
&gt; ++++ b/src/html/template/template_test.go<br>
&gt; +@@ -6,6 +6,7 @@ package template_test<br>
&gt; +<br>
&gt; + import (<br>
&gt; +           &quot;bytes&quot;<br>
&gt; ++         &quot;encoding/json&quot;<br>
&gt; +           . &quot;html/template&quot;<br>
&gt; +           &quot;strings&quot;<br>
&gt; +           &quot;testing&quot;<br>
&gt; +@@ -121,6 +122,44 @@ func TestNumbers(t *testing.T) {<br>
&gt; +           c.mustExecute(c.root, nil, &quot;12.34 7.5&quot;)<br>
&gt; + }<br>
&gt; +<br>
&gt; ++func TestStringsInScriptsWithJsonContentTypeAreCorrectlyEscaped(t *testing.T) \
{<br> &gt; ++         // See #33671 and #37634 for more context on this.<br>
&gt; ++         tests := []struct{ name, in string }{<br>
&gt; ++                     {&quot;empty&quot;, &quot;&quot;},<br>
&gt; ++                     {&quot;invalid&quot;, string(rune(-1))},<br>
&gt; ++                     {&quot;null&quot;, &quot;\u0000&quot;},<br>
&gt; ++                     {&quot;unit separator&quot;, &quot;\u001F&quot;},<br>
&gt; ++                     {&quot;tab&quot;, &quot;\t&quot;},<br>
&gt; ++                     {&quot;gt and lt&quot;, &quot;&lt;&gt;&quot;},<br>
&gt; ++                     {&quot;quotes&quot;, `&#39;&quot;`},<br>
&gt; ++                     {&quot;ASCII letters&quot;, &quot;ASCII \
letters&quot;},<br> &gt; ++                     {&quot;Unicode&quot;, \
&quot;ʕ⊙ϖ⊙ʔ&quot;},<br> &gt; ++                     {&quot;Pizza&quot;, \
&quot;🍕&quot;},<br> &gt; ++         }<br>
&gt; ++         const (<br>
&gt; ++                     prefix = `&lt;script \
type=&quot;application/ld+json&quot;&gt;`<br> &gt; ++                     suffix = \
`&lt;/script&gt;`<br> &gt; ++                     templ   = prefix + \
`&quot;{{.}}&quot;` + suffix<br> &gt; ++         )<br>
&gt; ++         tpl := Must(New(&quot;JS string is JSON \
string&quot;).Parse(templ))<br> &gt; ++         for _, tt := range tests {<br>
&gt; ++                     t.Run(<a href="http://tt.name" rel="noreferrer" \
target="_blank">tt.name</a>, func(t *testing.T) {<br> &gt; ++                         \
var buf bytes.Buffer<br> &gt; ++                                 if err := \
tpl.Execute(&amp;buf, <a href="http://tt.in" rel="noreferrer" \
target="_blank">tt.in</a>); err != nil {<br> &gt; ++                                  \
t.Fatalf(&quot;Cannot render template: %v&quot;, err)<br> &gt; ++                     \
}<br> &gt; ++                                 trimmed := \
bytes.TrimSuffix(bytes.TrimPrefix(buf.Bytes(), []byte(prefix)), []byte(suffix))<br> \
&gt; ++                                 var got string<br> &gt; ++                    \
if err := json.Unmarshal(trimmed, &amp;got); err != nil {<br> &gt; ++                 \
t.Fatalf(&quot;Cannot parse JS string %q as JSON: %v&quot;, \
trimmed[1:len(trimmed)-1], err)<br> &gt; ++                                 }<br>
&gt; ++                                 if got != <a href="http://tt.in" \
rel="noreferrer" target="_blank">tt.in</a> {<br> &gt; ++                              \
t.Errorf(&quot;Serialization changed the string value: got %q want %q&quot;, got, <a \
href="http://tt.in" rel="noreferrer" target="_blank">tt.in</a>)<br> &gt; ++           \
}<br> &gt; ++                     })<br>
&gt; ++         }<br>
&gt; ++}<br>
&gt; ++<br>
&gt; + type testCase struct {<br>
&gt; +           t      *testing.T<br>
&gt; +           root *Template<br>
&gt; +diff --git a/src/text/template/exec_test.go \
b/src/text/template/exec_test.go<br> &gt; +index 77294ed..b8a809e 100644<br>
&gt; +--- a/src/text/template/exec_test.go<br>
&gt; ++++ b/src/text/template/exec_test.go<br>
&gt; +@@ -911,9 +911,9 @@ func TestJSEscaping(t *testing.T) {<br>
&gt; +                       {`Go &quot;jump&quot; \`, `Go \&quot;jump\&quot; \
\\`},<br> &gt; +                       {`Yukihiro says &quot;今日は世界&quot;`, \
`Yukihiro says \&quot;今日は世界\&quot;`},<br> &gt; +                       \
{&quot;unprintable \uFDFF&quot;, `unprintable \uFDFF`},<br> &gt; +-                   \
{`&lt;html&gt;`, `\x3Chtml\x3E`},<br> &gt; +-                     {`no = in \
attributes`, `no \x3D in attributes`},<br> &gt; +-                     {`&amp;#x27; \
does not become HTML entity`, `\x26#x27; does not become HTML entity`},<br> &gt; ++   \
{`&lt;html&gt;`, `\u003Chtml\u003E`},<br> &gt; ++                     {`no = in \
attributes`, `no \u003D in attributes`},<br> &gt; ++                     {`&amp;#x27; \
does not become HTML entity`, `\u0026#x27; does not become HTML entity`},<br> &gt; +  \
}<br> &gt; +           for _, tc := range testCases {<br>
&gt; +                       s := JSEscapeString(<a href="http://tc.in" \
rel="noreferrer" target="_blank">tc.in</a>)<br> &gt;   diff --git \
a/src/text/template/funcs.go b/src/text/template/funcs.go<br> &gt;   index \
46125bc..f3de9fb 100644<br> &gt;   --- a/src/text/template/funcs.go<br>
&gt; diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_3.patch \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_3.patch<br> &gt; new file mode \
100644<br> &gt; index 0000000000..cd7dd0957c<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_3.patch<br>
&gt; @@ -0,0 +1,393 @@<br>
&gt; +From 7ddce23c7d5b728acf8482f5006497c7b9915f8a Mon Sep 17 00:00:00 2001<br>
&gt; +From: Ariel Mashraki &lt;<a href="mailto:ariel@mashraki.co.il" \
target="_blank">ariel@mashraki.co.il</a>&gt;<br> &gt; +Date: Wed, 22 Apr 2020 \
22:17:56 +0300<br> &gt; +Subject: [PATCH 3/6] text/template: add CommentNode to \
template parse tree<br> &gt; +MIME-Version: 1.0<br>
&gt; +Content-Type: text/plain; charset=UTF-8<br>
&gt; +Content-Transfer-Encoding: 8bit<br>
&gt; +<br>
&gt; +Fixes #34652<br>
&gt; +<br>
&gt; +Change-Id: Icf6e3eda593fed826736f34f95a9d66f5450cc98<br>
&gt; +Reviewed-on: <a href="https://go-review.googlesource.com/c/go/+/229398" \
rel="noreferrer" target="_blank">https://go-review.googlesource.com/c/go/+/229398</a><br>
 &gt; +Reviewed-by: Daniel Martí &lt;<a href="mailto:mvdan@mvdan.cc" \
target="_blank">mvdan@mvdan.cc</a>&gt;<br> &gt; +Run-TryBot: Daniel Martí &lt;<a \
href="mailto:mvdan@mvdan.cc" target="_blank">mvdan@mvdan.cc</a>&gt;<br> &gt; \
+TryBot-Result: Gobot Gobot &lt;<a href="mailto:gobot@golang.org" \
target="_blank">gobot@golang.org</a>&gt;<br> &gt; +<br>
&gt; +Dependency Patch #3<br>
&gt; +<br>
&gt; +Upstream-Status: Backport from <a \
href="https://github.com/golang/go/commit/c8ea03828b0645b1fd5725888e44873b75fcfbb6" \
rel="noreferrer" target="_blank">https://github.com/golang/go/commit/c8ea03828b0645b1fd5725888e44873b75fcfbb6</a><br>
 &gt; +CVE: CVE-2023-24538<br>
&gt; +Signed-off-by: Shubham Kulkarni &lt;<a href="mailto:skulkarni@mvista.com" \
target="_blank">skulkarni@mvista.com</a>&gt;<br> &gt; +---<br>
&gt; + api/next.txt                                       | 19 \
+++++++++++++++++++<br> &gt; + src/html/template/escape.go                 |   2 \
++<br> &gt; + src/html/template/template_test.go      | 16 ++++++++++++++++<br>
&gt; + src/text/template/exec.go                    |   1 +<br>
&gt; + src/text/template/parse/lex.go            |   8 +++++++-<br>
&gt; + src/text/template/parse/lex_test.go     |   7 +++++--<br>
&gt; + src/text/template/parse/node.go           | 33 \
+++++++++++++++++++++++++++++++++<br> &gt; + src/text/template/parse/parse.go         \
| 22 +++++++++++++++++++---<br> &gt; + src/text/template/parse/parse_test.go | 25 \
+++++++++++++++++++++++++<br> &gt; + 9 files changed, 127 insertions(+), 6 \
deletions(-)<br> &gt; +<br>
&gt; +diff --git a/api/next.txt b/api/next.txt<br>
&gt; +index e69de29..076f39e 100644<br>
&gt; +--- a/api/next.txt<br>
&gt; ++++ b/api/next.txt<br>
&gt; +@@ -0,0 +1,19 @@<br>
&gt; ++pkg unicode, const Version = &quot;13.0.0&quot;<br>
&gt; ++pkg unicode, var Chorasmian *RangeTable<br>
&gt; ++pkg unicode, var Dives_Akuru *RangeTable<br>
&gt; ++pkg unicode, var Khitan_Small_Script *RangeTable<br>
&gt; ++pkg unicode, var Yezidi *RangeTable<br>
&gt; ++pkg text/template/parse, const NodeComment = 20<br>
&gt; ++pkg text/template/parse, const NodeComment NodeType<br>
&gt; ++pkg text/template/parse, const ParseComments = 1<br>
&gt; ++pkg text/template/parse, const ParseComments Mode<br>
&gt; ++pkg text/template/parse, method (*CommentNode) Copy() Node<br>
&gt; ++pkg text/template/parse, method (*CommentNode) String() string<br>
&gt; ++pkg text/template/parse, method (CommentNode) Position() Pos<br>
&gt; ++pkg text/template/parse, method (CommentNode) Type() NodeType<br>
&gt; ++pkg text/template/parse, type CommentNode struct<br>
&gt; ++pkg text/template/parse, type CommentNode struct, Text string<br>
&gt; ++pkg text/template/parse, type CommentNode struct, embedded NodeType<br>
&gt; ++pkg text/template/parse, type CommentNode struct, embedded Pos<br>
&gt; ++pkg text/template/parse, type Mode uint<br>
&gt; ++pkg text/template/parse, type Tree struct, Mode Mode<br>
&gt; +diff --git a/src/html/template/escape.go b/src/html/template/escape.go<br>
&gt; +index f12dafa..8739735 100644<br>
&gt; +--- a/src/html/template/escape.go<br>
&gt; ++++ b/src/html/template/escape.go<br>
&gt; +@@ -124,6 +124,8 @@ func (e *escaper) escape(c context, n parse.Node) context \
{<br> &gt; +           switch n := n.(type) {<br>
&gt; +           case *parse.ActionNode:<br>
&gt; +                       return e.escapeAction(c, n)<br>
&gt; ++         case *parse.CommentNode:<br>
&gt; ++                     return c<br>
&gt; +           case *parse.IfNode:<br>
&gt; +                       return e.escapeBranch(c, &amp;n.BranchNode, \
&quot;if&quot;)<br> &gt; +           case *parse.ListNode:<br>
&gt; +diff --git a/src/html/template/template_test.go \
b/src/html/template/template_test.go<br> &gt; +index 86bd4db..1f2c888 100644<br>
&gt; +--- a/src/html/template/template_test.go<br>
&gt; ++++ b/src/html/template/template_test.go<br>
&gt; +@@ -10,6 +10,7 @@ import (<br>
&gt; +           . &quot;html/template&quot;<br>
&gt; +           &quot;strings&quot;<br>
&gt; +           &quot;testing&quot;<br>
&gt; ++         &quot;text/template/parse&quot;<br>
&gt; + )<br>
&gt; +<br>
&gt; + func TestTemplateClone(t *testing.T) {<br>
&gt; +@@ -160,6 +161,21 @@ func \
TestStringsInScriptsWithJsonContentTypeAreCorrectlyEscaped(t *testing.T) {<br> &gt; + \
}<br> &gt; + }<br>
&gt; +<br>
&gt; ++func TestSkipEscapeComments(t *testing.T) {<br>
&gt; ++         c := newTestCase(t)<br>
&gt; ++         tr := parse.New(&quot;root&quot;)<br>
&gt; ++         tr.Mode = parse.ParseComments<br>
&gt; ++         newT, err := tr.Parse(&quot;{{/* A comment */}}{{ 1 }}{{/* Another \
comment */}}&quot;, &quot;&quot;, &quot;&quot;, make(map[string]*parse.Tree))<br> \
&gt; ++         if err != nil {<br> &gt; ++                     t.Fatalf(&quot;Cannot \
parse template text: %v&quot;, err)<br> &gt; ++         }<br>
&gt; ++         c.root, err = c.root.AddParseTree(&quot;root&quot;, newT)<br>
&gt; ++         if err != nil {<br>
&gt; ++                     t.Fatalf(&quot;Cannot add parse tree to template: \
%v&quot;, err)<br> &gt; ++         }<br>
&gt; ++         c.mustExecute(c.root, nil, &quot;1&quot;)<br>
&gt; ++}<br>
&gt; ++<br>
&gt; + type testCase struct {<br>
&gt; +           t      *testing.T<br>
&gt; +           root *Template<br>
&gt; +diff --git a/src/text/template/exec.go b/src/text/template/exec.go<br>
&gt; +index ac3e741..7ac5175 100644<br>
&gt; +--- a/src/text/template/exec.go<br>
&gt; ++++ b/src/text/template/exec.go<br>
&gt; +@@ -256,6 +256,7 @@ func (s *state) walk(dot reflect.Value, node parse.Node) \
{<br> &gt; +                       if len(node.Pipe.Decl) == 0 {<br>
&gt; +                                   s.printValue(node, val)<br>
&gt; +                       }<br>
&gt; ++         case *parse.CommentNode:<br>
&gt; +           case *parse.IfNode:<br>
&gt; +                       s.walkIfOrWith(parse.NodeIf, dot, node.Pipe, node.List, \
node.ElseList)<br> &gt; +           case *parse.ListNode:<br>
&gt; +diff --git a/src/text/template/parse/lex.go \
b/src/text/template/parse/lex.go<br> &gt; +index 30371f2..e41373a 100644<br>
&gt; +--- a/src/text/template/parse/lex.go<br>
&gt; ++++ b/src/text/template/parse/lex.go<br>
&gt; +@@ -41,6 +41,7 @@ const (<br>
&gt; +           itemBool                                      // boolean \
constant<br> &gt; +           itemChar                                      // \
printable ASCII character; grab bag for comma etc.<br> &gt; +           \
itemCharConstant                          // character constant<br> &gt; ++         \
itemComment                                 // comment text<br> &gt; +           \
itemComplex                                 // complex constant (1+2i); imaginary is \
just a number<br> &gt; +           itemAssign                                   // \
equals (&#39;=&#39;) introducing an assignment<br> &gt; +           itemDeclare       \
// colon-equals (&#39;:=&#39;) introducing a declaration<br> &gt; +@@ -112,6 +113,7 \
@@ type lexer struct {<br> &gt; +           leftDelim         string      // start of \
action<br> &gt; +           rightDelim        string      // end of action<br>
&gt; +           trimRightDelim string      // end of action with trim marker<br>
&gt; ++         emitComment      bool         // emit itemComment tokens.<br>
&gt; +           pos                  Pos           // current position in the \
input<br> &gt; +           start               Pos           // start position of \
this item<br> &gt; +           width               Pos           // width of last \
rune read from input<br> &gt; +@@ -203,7 +205,7 @@ func (l *lexer) drain() {<br>
&gt; + }<br>
&gt; +<br>
&gt; + // lex creates a new scanner for the input string.<br>
&gt; +-func lex(name, input, left, right string) *lexer {<br>
&gt; ++func lex(name, input, left, right string, emitComment bool) *lexer {<br>
&gt; +           if left == &quot;&quot; {<br>
&gt; +                       left = leftDelim<br>
&gt; +           }<br>
&gt; +@@ -216,6 +218,7 @@ func lex(name, input, left, right string) *lexer {<br>
&gt; +                       leftDelim:         left,<br>
&gt; +                       rightDelim:        right,<br>
&gt; +                       trimRightDelim: rightTrimMarker + right,<br>
&gt; ++                     emitComment:      emitComment,<br>
&gt; +                       items:               make(chan item),<br>
&gt; +                       line:                 1,<br>
&gt; +                       startLine:         1,<br>
&gt; +@@ -323,6 +326,9 @@ func lexComment(l *lexer) stateFn {<br>
&gt; +           if !delim {<br>
&gt; +                       return l.errorf(&quot;comment ends before closing \
delimiter&quot;)<br> &gt; +           }<br>
&gt; ++         if l.emitComment {<br>
&gt; ++                     l.emit(itemComment)<br>
&gt; ++         }<br>
&gt; +           if trimSpace {<br>
&gt; +                       l.pos += trimMarkerLen<br>
&gt; +           }<br>
&gt; +diff --git a/src/text/template/parse/lex_test.go \
b/src/text/template/parse/lex_test.go<br> &gt; +index 563c4fc..f6d5f28 100644<br>
&gt; +--- a/src/text/template/parse/lex_test.go<br>
&gt; ++++ b/src/text/template/parse/lex_test.go<br>
&gt; +@@ -15,6 +15,7 @@ var itemName = map[itemType]string{<br>
&gt; +           itemBool:              &quot;bool&quot;,<br>
&gt; +           itemChar:              &quot;char&quot;,<br>
&gt; +           itemCharConstant: &quot;charconst&quot;,<br>
&gt; ++         itemComment:         &quot;comment&quot;,<br>
&gt; +           itemComplex:         &quot;complex&quot;,<br>
&gt; +           itemDeclare:         &quot;:=&quot;,<br>
&gt; +           itemEOF:               &quot;EOF&quot;,<br>
&gt; +@@ -90,6 +91,7 @@ var lexTests = []lexTest{<br>
&gt; +           {&quot;text&quot;, `now is the time`, []item{mkItem(itemText, \
&quot;now is the time&quot;), tEOF}},<br> &gt; +           {&quot;text with \
comment&quot;, &quot;hello-{{/* this is a comment */}}-world&quot;, []item{<br> &gt; \
+                       mkItem(itemText, &quot;hello-&quot;),<br> &gt; ++             \
mkItem(itemComment, &quot;/* this is a comment */&quot;),<br> &gt; +                  \
mkItem(itemText, &quot;-world&quot;),<br> &gt; +                       tEOF,<br>
&gt; +           }},<br>
&gt; +@@ -311,6 +313,7 @@ var lexTests = []lexTest{<br>
&gt; +           }},<br>
&gt; +           {&quot;trimming spaces before and after comment&quot;, &quot;hello- \
{{- /* hello */ -}} -world&quot;, []item{<br> &gt; +                       \
mkItem(itemText, &quot;hello-&quot;),<br> &gt; ++                     \
mkItem(itemComment, &quot;/* hello */&quot;),<br> &gt; +                       \
mkItem(itemText, &quot;-world&quot;),<br> &gt; +                       tEOF,<br>
&gt; +           }},<br>
&gt; +@@ -389,7 +392,7 @@ var lexTests = []lexTest{<br>
&gt; +<br>
&gt; + // collect gathers the emitted items into a slice.<br>
&gt; + func collect(t *lexTest, left, right string) (items []item) {<br>
&gt; +-         l := lex(<a href="http://t.name" rel="noreferrer" \
target="_blank">t.name</a>, t.input, left, right)<br> &gt; ++         l := lex(<a \
href="http://t.name" rel="noreferrer" target="_blank">t.name</a>, t.input, left, \
right, true)<br> &gt; +           for {<br>
&gt; +                       item := l.nextItem()<br>
&gt; +                       items = append(items, item)<br>
&gt; +@@ -529,7 +532,7 @@ func TestPos(t *testing.T) {<br>
&gt; + func TestShutdown(t *testing.T) {<br>
&gt; +           // We need to duplicate template.Parse here to hold on to the \
lexer.<br> &gt; +           const text = \
&quot;erroneous{{define}}{{else}}1234&quot;<br> &gt; +-         lexer := \
lex(&quot;foo&quot;, text, &quot;{{&quot;, &quot;}}&quot;)<br> &gt; ++         lexer \
:= lex(&quot;foo&quot;, text, &quot;{{&quot;, &quot;}}&quot;, false)<br> &gt; +       \
_, err := New(&quot;root&quot;).parseLexer(lexer)<br> &gt; +           if err == nil \
{<br> &gt; +                       t.Fatalf(&quot;expected error&quot;)<br>
&gt; +diff --git a/src/text/template/parse/node.go \
b/src/text/template/parse/node.go<br> &gt; +index 1c116ea..a9dad5e 100644<br>
&gt; +--- a/src/text/template/parse/node.go<br>
&gt; ++++ b/src/text/template/parse/node.go<br>
&gt; +@@ -70,6 +70,7 @@ const (<br>
&gt; +           NodeTemplate                             // A template invocation \
action.<br> &gt; +           NodeVariable                             // A $ \
variable.<br> &gt; +           NodeWith                                   // A with \
action.<br> &gt; ++         NodeComment                              // A \
comment.<br> &gt; + )<br>
&gt; +<br>
&gt; + // Nodes.<br>
&gt; +@@ -149,6 +150,38 @@ func (t *TextNode) Copy() Node {<br>
&gt; +           return &amp;TextNode{tr: <a href="http://t.tr" rel="noreferrer" \
target="_blank">t.tr</a>, NodeType: NodeText, Pos: t.Pos, Text: append([]byte{}, \
t.Text...)}<br> &gt; + }<br>
&gt; +<br>
&gt; ++// CommentNode holds a comment.<br>
&gt; ++type CommentNode struct {<br>
&gt; ++         NodeType<br>
&gt; ++         Pos<br>
&gt; ++         tr     *Tree<br>
&gt; ++         Text string // Comment text.<br>
&gt; ++}<br>
&gt; ++<br>
&gt; ++func (t *Tree) newComment(pos Pos, text string) *CommentNode {<br>
&gt; ++         return &amp;CommentNode{tr: t, NodeType: NodeComment, Pos: pos, Text: \
text}<br> &gt; ++}<br>
&gt; ++<br>
&gt; ++func (c *CommentNode) String() string {<br>
&gt; ++         var sb strings.Builder<br>
&gt; ++         c.writeTo(&amp;sb)<br>
&gt; ++         return sb.String()<br>
&gt; ++}<br>
&gt; ++<br>
&gt; ++func (c *CommentNode) writeTo(sb *strings.Builder) {<br>
&gt; ++         sb.WriteString(&quot;{{&quot;)<br>
&gt; ++         sb.WriteString(c.Text)<br>
&gt; ++         sb.WriteString(&quot;}}&quot;)<br>
&gt; ++}<br>
&gt; ++<br>
&gt; ++func (c *CommentNode) tree() *Tree {<br>
&gt; ++         return <a href="http://c.tr" rel="noreferrer" \
target="_blank">c.tr</a><br> &gt; ++}<br>
&gt; ++<br>
&gt; ++func (c *CommentNode) Copy() Node {<br>
&gt; ++         return &amp;CommentNode{tr: <a href="http://c.tr" rel="noreferrer" \
target="_blank">c.tr</a>, NodeType: NodeComment, Pos: c.Pos, Text: c.Text}<br> &gt; \
++}<br> &gt; ++<br>
&gt; + // PipeNode holds a pipeline with optional declaration<br>
&gt; + type PipeNode struct {<br>
&gt; +           NodeType<br>
&gt; +diff --git a/src/text/template/parse/parse.go \
b/src/text/template/parse/parse.go<br> &gt; +index c9b80f4..496d8bf 100644<br>
&gt; +--- a/src/text/template/parse/parse.go<br>
&gt; ++++ b/src/text/template/parse/parse.go<br>
&gt; +@@ -21,6 +21,7 @@ type Tree struct {<br>
&gt; +           Name         string      // name of the template represented by the \
tree.<br> &gt; +           ParseName string      // name of the top-level template \
during parsing, for error messages.<br> &gt; +           Root         *ListNode // \
top-level root of the tree.<br> &gt; ++         Mode         Mode         // parsing \
mode.<br> &gt; +           text         string      // text parsed to create the \
template (or its parent)<br> &gt; +           // Parsing only; cleared after \
parse.<br> &gt; +           funcs        []map[string]interface{}<br>
&gt; +@@ -29,8 +30,16 @@ type Tree struct {<br>
&gt; +           peekCount int<br>
&gt; +           vars         []string // variables defined at the moment.<br>
&gt; +           treeSet     map[string]*Tree<br>
&gt; ++         mode         Mode<br>
&gt; + }<br>
&gt; +<br>
&gt; ++// A mode value is a set of flags (or 0). Modes control parser behavior.<br>
&gt; ++type Mode uint<br>
&gt; ++<br>
&gt; ++const (<br>
&gt; ++         ParseComments Mode = 1 &lt;&lt; iota // parse comments and add them \
to AST<br> &gt; ++)<br>
&gt; ++<br>
&gt; + // Copy returns a copy of the Tree. Any parsing state is discarded.<br>
&gt; + func (t *Tree) Copy() *Tree {<br>
&gt; +           if t == nil {<br>
&gt; +@@ -220,7 +229,8 @@ func (t *Tree) stopParse() {<br>
&gt; + func (t *Tree) Parse(text, leftDelim, rightDelim string, treeSet \
map[string]*Tree, funcs ...map[string]interface{}) (tree *Tree, err error) {<br> &gt; \
+           defer t.recover(&amp;err)<br> &gt; +           t.ParseName = t.Name<br>
&gt; +-         t.startParse(funcs, lex(t.Name, text, leftDelim, rightDelim), \
treeSet)<br> &gt; ++         emitComment := t.Mode&amp;ParseComments != 0<br>
&gt; ++         t.startParse(funcs, lex(t.Name, text, leftDelim, rightDelim, \
emitComment), treeSet)<br> &gt; +           t.text = text<br>
&gt; +           t.parse()<br>
&gt; +           t.add()<br>
&gt; +@@ -240,12 +250,14 @@ func (t *Tree) add() {<br>
&gt; +           }<br>
&gt; + }<br>
&gt; +<br>
&gt; +-// IsEmptyTree reports whether this tree (node) is empty of everything but \
space.<br> &gt; ++// IsEmptyTree reports whether this tree (node) is empty of \
everything but space or comments.<br> &gt; + func IsEmptyTree(n Node) bool {<br>
&gt; +           switch n := n.(type) {<br>
&gt; +           case nil:<br>
&gt; +                       return true<br>
&gt; +           case *ActionNode:<br>
&gt; ++         case *CommentNode:<br>
&gt; ++                     return true<br>
&gt; +           case *IfNode:<br>
&gt; +           case *ListNode:<br>
&gt; +                       for _, node := range n.Nodes {<br>
&gt; +@@ -276,6 +288,7 @@ func (t *Tree) parse() {<br>
&gt; +                                   if t.nextNonSpace().typ == itemDefine {<br>
&gt; +                                               newT := \
New(&quot;definition&quot;) // name will be updated once we know it.<br> &gt; +       \
newT.text = t.text<br> &gt; ++                                             newT.Mode \
= t.Mode<br> &gt; +                                               newT.ParseName = \
t.ParseName<br> &gt; +                                               \
newT.startParse(t.funcs, t.lex, t.treeSet)<br> &gt; +                                 \
newT.parseDefinition()<br> &gt; +@@ -331,13 +344,15 @@ func (t *Tree) itemList() \
(list *ListNode, next Node) {<br> &gt; + }<br>
&gt; +<br>
&gt; + // textOrAction:<br>
&gt; +-//      text | action<br>
&gt; ++//      text | comment | action<br>
&gt; + func (t *Tree) textOrAction() Node {<br>
&gt; +           switch token := t.nextNonSpace(); token.typ {<br>
&gt; +           case itemText:<br>
&gt; +                       return t.newText(token.pos, token.val)<br>
&gt; +           case itemLeftDelim:<br>
&gt; +                       return t.action()<br>
&gt; ++         case itemComment:<br>
&gt; ++                     return t.newComment(token.pos, token.val)<br>
&gt; +           default:<br>
&gt; +                       t.unexpected(token, &quot;input&quot;)<br>
&gt; +           }<br>
&gt; +@@ -539,6 +554,7 @@ func (t *Tree) blockControl() Node {<br>
&gt; +<br>
&gt; +           block := New(name) // name will be updated once we know it.<br>
&gt; +           block.text = t.text<br>
&gt; ++         block.Mode = t.Mode<br>
&gt; +           block.ParseName = t.ParseName<br>
&gt; +           block.startParse(t.funcs, t.lex, t.treeSet)<br>
&gt; +           var end Node<br>
&gt; +diff --git a/src/text/template/parse/parse_test.go \
b/src/text/template/parse/parse_test.go<br> &gt; +index 4e09a78..d9c13c5 100644<br>
&gt; +--- a/src/text/template/parse/parse_test.go<br>
&gt; ++++ b/src/text/template/parse/parse_test.go<br>
&gt; +@@ -348,6 +348,30 @@ func TestParseCopy(t *testing.T) {<br>
&gt; +           testParse(true, t)<br>
&gt; + }<br>
&gt; +<br>
&gt; ++func TestParseWithComments(t *testing.T) {<br>
&gt; ++         textFormat = &quot;%q&quot;<br>
&gt; ++         defer func() { textFormat = &quot;%s&quot; }()<br>
&gt; ++         tests := [...]parseTest{<br>
&gt; ++                     {&quot;comment&quot;, &quot;{{/*\n\n\n*/}}&quot;, \
noError, &quot;{{/*\n\n\n*/}}&quot;},<br> &gt; ++                     {&quot;comment \
trim left&quot;, &quot;x \r\n\t{{- /* hi */}}&quot;, noError, `&quot;x&quot;{{/* hi \
*/}}`},<br> &gt; ++                     {&quot;comment trim right&quot;, &quot;{{/* \
hi */ -}}\n\n\ty&quot;, noError, `{{/* hi */}}&quot;y&quot;`},<br> &gt; ++            \
{&quot;comment trim left and right&quot;, &quot;x \r\n\t{{- /* */ -}}\n\n\ty&quot;, \
noError, `&quot;x&quot;{{/* */}}&quot;y&quot;`},<br> &gt; ++         }<br>
&gt; ++         for _, test := range tests {<br>
&gt; ++                     t.Run(<a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>, func(t *testing.T) {<br> &gt; ++                       \
tr := New(<a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>)<br> &gt; ++                                 tr.Mode = \
ParseComments<br> &gt; ++                                 tmpl, err := \
tr.Parse(test.input, &quot;&quot;, &quot;&quot;, make(map[string]*Tree))<br> &gt; ++  \
if err != nil {<br> &gt; ++                                             \
t.Errorf(&quot;%q: expected error; got none&quot;, <a href="http://test.name" \
rel="noreferrer" target="_blank">test.name</a>)<br> &gt; ++                           \
}<br> &gt; ++                                 if result := tmpl.Root.String(); result \
!= test.result {<br> &gt; ++                                             \
t.Errorf(&quot;%s=(%q): got\n\t%v\nexpected\n\t%v&quot;, <a href="http://test.name" \
rel="noreferrer" target="_blank">test.name</a>, test.input, result, test.result)<br> \
&gt; ++                                 }<br> &gt; ++                     })<br>
&gt; ++         }<br>
&gt; ++}<br>
&gt; ++<br>
&gt; + type isEmptyTest struct {<br>
&gt; +           name   string<br>
&gt; +           input string<br>
&gt; +@@ -358,6 +382,7 @@ var isEmptyTests = []isEmptyTest{<br>
&gt; +           {&quot;empty&quot;, ``, true},<br>
&gt; +           {&quot;nonempty&quot;, `hello`, false},<br>
&gt; +           {&quot;spaces only&quot;, &quot; \t\n \t\n&quot;, true},<br>
&gt; ++         {&quot;comment only&quot;, &quot;{{/* comment */}}&quot;, true},<br>
&gt; +           {&quot;definition&quot;, `{{define &quot;x&quot;}}something{{end}}`, \
true},<br> &gt; +           {&quot;definitions and space&quot;, &quot;{{define \
`x`}}something{{end}}\n\n{{define `y`}}something{{end}}\n\n&quot;, true},<br> &gt; +  \
{&quot;definitions and text&quot;, &quot;{{define `x`}}something{{end}}\nx\n{{define \
`y`}}something{{end}}\ny\n&quot;, false},<br> &gt; +--<br>
&gt; +2.7.4<br>
&gt; diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_4.patch \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_4.patch<br> &gt; new file mode \
100644<br> &gt; index 0000000000..d5e2eb6684<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_4.patch<br>
&gt; @@ -0,0 +1,497 @@<br>
&gt; +From 760d88497091fb5d6d231a18e6f4e06ecb9af9b2 Mon Sep 17 00:00:00 2001<br>
&gt; +From: Russ Cox &lt;<a href="mailto:rsc@golang.org" \
target="_blank">rsc@golang.org</a>&gt;<br> &gt; +Date: Thu, 10 Sep 2020 18:53:26 \
-0400<br> &gt; +Subject: [PATCH 4/6] text/template: allow newlines inside action \
delimiters<br> &gt; +<br>
&gt; +This allows multiline constructs like:<br>
&gt; +<br>
&gt; +           {{&quot;hello&quot; |<br>
&gt; +              printf}}<br>
&gt; +<br>
&gt; +Now that unclosed actions can span multiple lines,<br>
&gt; +track and report the start of the action when reporting errors.<br>
&gt; +<br>
&gt; +Also clean up a few &quot;unexpected &lt;error message&gt;&quot; to be just \
&quot;&lt;error message&gt;&quot;.<br> &gt; +<br>
&gt; +Fixes #29770.<br>
&gt; +<br>
&gt; +Change-Id: I54c6c016029a8328b7902a4b6d85eab713ec3285<br>
&gt; +Reviewed-on: <a href="https://go-review.googlesource.com/c/go/+/254257" \
rel="noreferrer" target="_blank">https://go-review.googlesource.com/c/go/+/254257</a><br>
 &gt; +Trust: Russ Cox &lt;<a href="mailto:rsc@golang.org" \
target="_blank">rsc@golang.org</a>&gt;<br> &gt; +Run-TryBot: Russ Cox &lt;<a \
href="mailto:rsc@golang.org" target="_blank">rsc@golang.org</a>&gt;<br> &gt; \
+TryBot-Result: Go Bot &lt;<a href="mailto:gobot@golang.org" \
target="_blank">gobot@golang.org</a>&gt;<br> &gt; +Reviewed-by: Rob Pike &lt;<a \
href="mailto:r@golang.org" target="_blank">r@golang.org</a>&gt;<br> &gt; +<br>
&gt; +Dependency Patch #4<br>
&gt; +<br>
&gt; +Upstream-Status: Backport from <a \
href="https://github.com/golang/go/commit/9384d34c58099657bb1b133beaf3ff37ada9b017" \
rel="noreferrer" target="_blank">https://github.com/golang/go/commit/9384d34c58099657bb1b133beaf3ff37ada9b017</a><br>
 &gt; +CVE: CVE-2023-24538<br>
&gt; +Signed-off-by: Shubham Kulkarni &lt;<a href="mailto:skulkarni@mvista.com" \
target="_blank">skulkarni@mvista.com</a>&gt;<br> &gt; +---<br>
&gt; + src/text/template/doc.go                     | 21 ++++-----<br>
&gt; + src/text/template/exec_test.go            |   2 +-<br>
&gt; + src/text/template/parse/lex.go            | 84 \
+++++++++++++++++------------------<br> &gt; + src/text/template/parse/lex_test.go    \
|   2 +-<br> &gt; + src/text/template/parse/parse.go         | 59 \
+++++++++++++-----------<br> &gt; + src/text/template/parse/parse_test.go | 36 \
++++++++++++---<br> &gt; + 6 files changed, 117 insertions(+), 87 deletions(-)<br>
&gt; +<br>
&gt; +diff --git a/src/text/template/doc.go b/src/text/template/doc.go<br>
&gt; +index 4b0efd2..7b30294 100644<br>
&gt; +--- a/src/text/template/doc.go<br>
&gt; ++++ b/src/text/template/doc.go<br>
&gt; +@@ -40,16 +40,17 @@ More intricate examples appear below.<br>
&gt; + Text and spaces<br>
&gt; +<br>
&gt; + By default, all text between actions is copied verbatim when the template \
is<br> &gt; +-executed. For example, the string &quot; items are made of &quot; in \
the example above appears<br> &gt; +-on standard output when the program is run.<br>
&gt; +-<br>
&gt; +-However, to aid in formatting template source code, if an action&#39;s left \
delimiter<br> &gt; +-(by default &quot;{{&quot;) is followed immediately by a minus \
sign and ASCII space character<br> &gt; +-(&quot;{{- &quot;), all trailing white \
space is trimmed from the immediately preceding text.<br> &gt; +-Similarly, if the \
right delimiter (&quot;}}&quot;) is preceded by a space and minus sign<br> &gt; \
+-(&quot; -}}&quot;), all leading white space is trimmed from the immediately \
following text.<br> &gt; +-In these trim markers, the ASCII space must be present; \
&quot;{{-3}}&quot; parses as an<br> &gt; +-action containing the number -3.<br>
&gt; ++executed. For example, the string &quot; items are made of &quot; in the \
example above<br> &gt; ++appears on standard output when the program is run.<br>
&gt; ++<br>
&gt; ++However, to aid in formatting template source code, if an action&#39;s \
left<br> &gt; ++delimiter (by default &quot;{{&quot;) is followed immediately by a \
minus sign and white<br> &gt; ++space, all trailing white space is trimmed from the \
immediately preceding text.<br> &gt; ++Similarly, if the right delimiter \
(&quot;}}&quot;) is preceded by white space and a minus<br> &gt; ++sign, all leading \
white space is trimmed from the immediately following text.<br> &gt; ++In these trim \
markers, the white space must be present:<br> &gt; ++&quot;{{- 3}}&quot; is like \
&quot;{{3}}&quot; but trims the immediately preceding text, while<br> &gt; \
++&quot;{{-3}}&quot; parses as an action containing the number -3.<br> &gt; +<br>
&gt; + For instance, when executing the template whose source is<br>
&gt; +<br>
&gt; +diff --git a/src/text/template/exec_test.go \
b/src/text/template/exec_test.go<br> &gt; +index b8a809e..3309b33 100644<br>
&gt; +--- a/src/text/template/exec_test.go<br>
&gt; ++++ b/src/text/template/exec_test.go<br>
&gt; +@@ -1295,7 +1295,7 @@ func TestUnterminatedStringError(t *testing.T) {<br>
&gt; +                       t.Fatal(&quot;expected error&quot;)<br>
&gt; +           }<br>
&gt; +           str := err.Error()<br>
&gt; +-         if !strings.Contains(str, &quot;X:3: unexpected unterminated raw \
quoted string&quot;) {<br> &gt; ++         if !strings.Contains(str, &quot;X:3: \
unterminated raw quoted string&quot;) {<br> &gt; +                       \
t.Fatalf(&quot;unexpected error: %s&quot;, str)<br> &gt; +           }<br>
&gt; + }<br>
&gt; +diff --git a/src/text/template/parse/lex.go \
b/src/text/template/parse/lex.go<br> &gt; +index e41373a..6784071 100644<br>
&gt; +--- a/src/text/template/parse/lex.go<br>
&gt; ++++ b/src/text/template/parse/lex.go<br>
&gt; +@@ -92,15 +92,14 @@ const eof = -1<br>
&gt; + // If the action begins &quot;{{- &quot; rather than &quot;{{&quot;, then all \
space/tab/newlines<br> &gt; + // preceding the action are trimmed; conversely if it \
ends &quot; -}}&quot; the<br> &gt; + // leading spaces are trimmed. This is done \
entirely in the lexer; the<br> &gt; +-// parser never sees it happen. We require an \
ASCII space to be<br> &gt; +-// present to avoid ambiguity with things like \
&quot;{{-3}}&quot;. It reads<br> &gt; ++// parser never sees it happen. We require an \
ASCII space (&#39; &#39;, \t, \r, \n)<br> &gt; ++// to be present to avoid ambiguity \
with things like &quot;{{-3}}&quot;. It reads<br> &gt; + // better with the space \
present anyway. For simplicity, only ASCII<br> &gt; +-// space does the job.<br>
&gt; ++// does the job.<br>
&gt; + const (<br>
&gt; +-         spaceChars         = &quot; \t\r\n&quot; // These are the space \
characters defined by Go itself.<br> &gt; +-         leftTrimMarker   = &quot;- \
&quot;         // Attached to left delimiter, trims trailing spaces from preceding \
text.<br> &gt; +-         rightTrimMarker = &quot; -&quot;         // Attached to \
right delimiter, trims leading spaces from following text.<br> &gt; +-         \
trimMarkerLen     = Pos(len(leftTrimMarker))<br> &gt; ++         spaceChars      = \
&quot; \t\r\n&quot;   // These are the space characters defined by Go itself.<br> \
&gt; ++         trimMarker      = &#39;-&#39;            // Attached to left/right \
delimiter, trims trailing spaces from preceding/following text.<br> &gt; ++         \
trimMarkerLen = Pos(1 + 1) // marker plus space before or after<br> &gt; + )<br>
&gt; +<br>
&gt; + // stateFn represents the state of the scanner as a function that returns the \
next state.<br> &gt; +@@ -108,19 +107,18 @@ type stateFn func(*lexer) stateFn<br>
&gt; +<br>
&gt; + // lexer holds the state of the scanner.<br>
&gt; + type lexer struct {<br>
&gt; +-         name                 string      // the name of the input; used only \
for error reports<br> &gt; +-         input               string      // the string \
being scanned<br> &gt; +-         leftDelim         string      // start of \
action<br> &gt; +-         rightDelim        string      // end of action<br>
&gt; +-         trimRightDelim string      // end of action with trim marker<br>
&gt; +-         emitComment      bool         // emit itemComment tokens.<br>
&gt; +-         pos                  Pos           // current position in the \
input<br> &gt; +-         start               Pos           // start position of this \
item<br> &gt; +-         width               Pos           // width of last rune read \
from input<br> &gt; +-         items               chan item // channel of scanned \
items<br> &gt; +-         parenDepth        int           // nesting depth of ( ) \
exprs<br> &gt; +-         line                 int           // 1+number of newlines \
seen<br> &gt; +-         startLine         int           // start line of this \
item<br> &gt; ++         name            string      // the name of the input; used \
only for error reports<br> &gt; ++         input           string      // the string \
being scanned<br> &gt; ++         leftDelim     string      // start of action<br>
&gt; ++         rightDelim   string      // end of action<br>
&gt; ++         emitComment bool         // emit itemComment tokens.<br>
&gt; ++         pos              Pos           // current position in the input<br>
&gt; ++         start           Pos           // start position of this item<br>
&gt; ++         width           Pos           // width of last rune read from \
input<br> &gt; ++         items           chan item // channel of scanned items<br>
&gt; ++         parenDepth   int           // nesting depth of ( ) exprs<br>
&gt; ++         line            int           // 1+number of newlines seen<br>
&gt; ++         startLine     int           // start line of this item<br>
&gt; + }<br>
&gt; +<br>
&gt; + // next returns the next rune in the input.<br>
&gt; +@@ -213,15 +211,14 @@ func lex(name, input, left, right string, emitComment \
bool) *lexer {<br> &gt; +                       right = rightDelim<br>
&gt; +           }<br>
&gt; +           l := &amp;lexer{<br>
&gt; +-                     name:                 name,<br>
&gt; +-                     input:               input,<br>
&gt; +-                     leftDelim:         left,<br>
&gt; +-                     rightDelim:        right,<br>
&gt; +-                     trimRightDelim: rightTrimMarker + right,<br>
&gt; +-                     emitComment:      emitComment,<br>
&gt; +-                     items:               make(chan item),<br>
&gt; +-                     line:                 1,<br>
&gt; +-                     startLine:         1,<br>
&gt; ++                     name:            name,<br>
&gt; ++                     input:           input,<br>
&gt; ++                     leftDelim:     left,<br>
&gt; ++                     rightDelim:   right,<br>
&gt; ++                     emitComment: emitComment,<br>
&gt; ++                     items:           make(chan item),<br>
&gt; ++                     line:            1,<br>
&gt; ++                     startLine:     1,<br>
&gt; +           }<br>
&gt; +           go l.run()<br>
&gt; +           return l<br>
&gt; +@@ -251,7 +248,7 @@ func lexText(l *lexer) stateFn {<br>
&gt; +                       ldn := Pos(len(l.leftDelim))<br>
&gt; +                       l.pos += Pos(x)<br>
&gt; +                       trimLength := Pos(0)<br>
&gt; +-                     if strings.HasPrefix(l.input[l.pos+ldn:], leftTrimMarker) \
{<br> &gt; ++                     if hasLeftTrimMarker(l.input[l.pos+ldn:]) {<br>
&gt; +                                   trimLength = \
rightTrimLength(l.input[l.start:l.pos])<br> &gt; +                       }<br>
&gt; +                       l.pos -= trimLength<br>
&gt; +@@ -280,7 +277,7 @@ func rightTrimLength(s string) Pos {<br>
&gt; +<br>
&gt; + // atRightDelim reports whether the lexer is at a right delimiter, possibly \
preceded by a trim marker.<br> &gt; + func (l *lexer) atRightDelim() (delim, \
trimSpaces bool) {<br> &gt; +-         if strings.HasPrefix(l.input[l.pos:], \
l.trimRightDelim) { // With trim marker.<br> &gt; ++         if \
hasRightTrimMarker(l.input[l.pos:]) &amp;&amp; \
strings.HasPrefix(l.input[l.pos+trimMarkerLen:], l.rightDelim) { // With trim \
marker.<br> &gt; +                       return true, true<br>
&gt; +           }<br>
&gt; +           if strings.HasPrefix(l.input[l.pos:], l.rightDelim) { // Without \
trim marker.<br> &gt; +@@ -297,7 +294,7 @@ func leftTrimLength(s string) Pos {<br>
&gt; + // lexLeftDelim scans the left delimiter, which is known to be present, \
possibly with a trim marker.<br> &gt; + func lexLeftDelim(l *lexer) stateFn {<br>
&gt; +           l.pos += Pos(len(l.leftDelim))<br>
&gt; +-         trimSpace := strings.HasPrefix(l.input[l.pos:], leftTrimMarker)<br>
&gt; ++         trimSpace := hasLeftTrimMarker(l.input[l.pos:])<br>
&gt; +           afterMarker := Pos(0)<br>
&gt; +           if trimSpace {<br>
&gt; +                       afterMarker = trimMarkerLen<br>
&gt; +@@ -342,7 +339,7 @@ func lexComment(l *lexer) stateFn {<br>
&gt; +<br>
&gt; + // lexRightDelim scans the right delimiter, which is known to be present, \
possibly with a trim marker.<br> &gt; + func lexRightDelim(l *lexer) stateFn {<br>
&gt; +-         trimSpace := strings.HasPrefix(l.input[l.pos:], rightTrimMarker)<br>
&gt; ++         trimSpace := hasRightTrimMarker(l.input[l.pos:])<br>
&gt; +           if trimSpace {<br>
&gt; +                       l.pos += trimMarkerLen<br>
&gt; +                       l.ignore()<br>
&gt; +@@ -369,7 +366,7 @@ func lexInsideAction(l *lexer) stateFn {<br>
&gt; +                       return l.errorf(&quot;unclosed left paren&quot;)<br>
&gt; +           }<br>
&gt; +           switch r := l.next(); {<br>
&gt; +-         case r == eof || isEndOfLine(r):<br>
&gt; ++         case r == eof:<br>
&gt; +                       return l.errorf(&quot;unclosed action&quot;)<br>
&gt; +           case isSpace(r):<br>
&gt; +                       l.backup() // Put space back in case we have &quot; \
-}}&quot;.<br> &gt; +@@ -439,7 +436,7 @@ func lexSpace(l *lexer) stateFn {<br>
&gt; +           }<br>
&gt; +           // Be careful about a trim-marked closing delimiter, which has a \
minus<br> &gt; +           // after a space. We know there is a space, so check for \
the &#39;-&#39; that might follow.<br> &gt; +-         if \
strings.HasPrefix(l.input[l.pos-1:], l.trimRightDelim) {<br> &gt; ++         if \
hasRightTrimMarker(l.input[l.pos-1:]) &amp;&amp; \
strings.HasPrefix(l.input[l.pos-1+trimMarkerLen:], l.rightDelim) {<br> &gt; +         \
l.backup() // Before the space.<br> &gt; +                       if numSpaces == 1 \
{<br> &gt; +                                   return lexRightDelim // On the delim, \
so go right to that.<br> &gt; +@@ -526,7 +523,7 @@ func lexFieldOrVariable(l *lexer, \
typ itemType) stateFn {<br> &gt; + // day to implement arithmetic.<br>
&gt; + func (l *lexer) atTerminator() bool {<br>
&gt; +           r := l.peek()<br>
&gt; +-         if isSpace(r) || isEndOfLine(r) {<br>
&gt; ++         if isSpace(r) {<br>
&gt; +                       return true<br>
&gt; +           }<br>
&gt; +           switch r {<br>
&gt; +@@ -657,15 +654,18 @@ Loop:<br>
&gt; +<br>
&gt; + // isSpace reports whether r is a space character.<br>
&gt; + func isSpace(r rune) bool {<br>
&gt; +-         return r == &#39; &#39; || r == &#39;\t&#39;<br>
&gt; +-}<br>
&gt; +-<br>
&gt; +-// isEndOfLine reports whether r is an end-of-line character.<br>
&gt; +-func isEndOfLine(r rune) bool {<br>
&gt; +-         return r == &#39;\r&#39; || r == &#39;\n&#39;<br>
&gt; ++         return r == &#39; &#39; || r == &#39;\t&#39; || r == &#39;\r&#39; || \
r == &#39;\n&#39;<br> &gt; + }<br>
&gt; +<br>
&gt; + // isAlphaNumeric reports whether r is an alphabetic, digit, or \
underscore.<br> &gt; + func isAlphaNumeric(r rune) bool {<br>
&gt; +           return r == &#39;_&#39; || unicode.IsLetter(r) || \
unicode.IsDigit(r)<br> &gt; + }<br>
&gt; ++<br>
&gt; ++func hasLeftTrimMarker(s string) bool {<br>
&gt; ++         return len(s) &gt;= 2 &amp;&amp; s[0] == trimMarker &amp;&amp; \
isSpace(rune(s[1]))<br> &gt; ++}<br>
&gt; ++<br>
&gt; ++func hasRightTrimMarker(s string) bool {<br>
&gt; ++         return len(s) &gt;= 2 &amp;&amp; isSpace(rune(s[0])) &amp;&amp; s[1] \
== trimMarker<br> &gt; ++}<br>
&gt; +diff --git a/src/text/template/parse/lex_test.go \
b/src/text/template/parse/lex_test.go<br> &gt; +index f6d5f28..6510eed 100644<br>
&gt; +--- a/src/text/template/parse/lex_test.go<br>
&gt; ++++ b/src/text/template/parse/lex_test.go<br>
&gt; +@@ -323,7 +323,7 @@ var lexTests = []lexTest{<br>
&gt; +                       tLeft,<br>
&gt; +                       mkItem(itemError, &quot;unrecognized character in \
action: U+0001&quot;),<br> &gt; +           }},<br>
&gt; +-         {&quot;unclosed action&quot;, &quot;{{\n}}&quot;, []item{<br>
&gt; ++         {&quot;unclosed action&quot;, &quot;{{&quot;, []item{<br>
&gt; +                       tLeft,<br>
&gt; +                       mkItem(itemError, &quot;unclosed action&quot;),<br>
&gt; +           }},<br>
&gt; +diff --git a/src/text/template/parse/parse.go \
b/src/text/template/parse/parse.go<br> &gt; +index 496d8bf..5e6e512 100644<br>
&gt; +--- a/src/text/template/parse/parse.go<br>
&gt; ++++ b/src/text/template/parse/parse.go<br>
&gt; +@@ -24,13 +24,14 @@ type Tree struct {<br>
&gt; +           Mode         Mode         // parsing mode.<br>
&gt; +           text         string      // text parsed to create the template (or \
its parent)<br> &gt; +           // Parsing only; cleared after parse.<br>
&gt; +-         funcs        []map[string]interface{}<br>
&gt; +-         lex           *lexer<br>
&gt; +-         token        [3]item // three-token lookahead for parser.<br>
&gt; +-         peekCount int<br>
&gt; +-         vars         []string // variables defined at the moment.<br>
&gt; +-         treeSet     map[string]*Tree<br>
&gt; +-         mode         Mode<br>
&gt; ++         funcs         []map[string]interface{}<br>
&gt; ++         lex            *lexer<br>
&gt; ++         token         [3]item // three-token lookahead for parser.<br>
&gt; ++         peekCount   int<br>
&gt; ++         vars           []string // variables defined at the moment.<br>
&gt; ++         treeSet      map[string]*Tree<br>
&gt; ++         actionLine int // line of left delim starting action<br>
&gt; ++         mode           Mode<br>
&gt; + }<br>
&gt; +<br>
&gt; + // A mode value is a set of flags (or 0). Modes control parser behavior.<br>
&gt; +@@ -187,6 +188,16 @@ func (t *Tree) expectOneOf(expected1, expected2 itemType, \
context string) item {<br> &gt; +<br>
&gt; + // unexpected complains about the token and terminates processing.<br>
&gt; + func (t *Tree) unexpected(token item, context string) {<br>
&gt; ++         if token.typ == itemError {<br>
&gt; ++                     extra := &quot;&quot;<br>
&gt; ++                     if t.actionLine != 0 &amp;&amp; t.actionLine != \
token.line {<br> &gt; ++                                 extra = fmt.Sprintf(&quot; \
in action started at %s:%d&quot;, t.ParseName, t.actionLine)<br> &gt; ++              \
if strings.HasSuffix(token.val, &quot; action&quot;) {<br> &gt; ++                    \
extra = extra[len(&quot; in action&quot;):] // avoid &quot;action in action&quot;<br> \
&gt; ++                                 }<br> &gt; ++                     }<br>
&gt; ++                     t.errorf(&quot;%s%s&quot;, token, extra)<br>
&gt; ++         }<br>
&gt; +           t.errorf(&quot;unexpected %s in %s&quot;, token, context)<br>
&gt; + }<br>
&gt; +<br>
&gt; +@@ -350,6 +361,8 @@ func (t *Tree) textOrAction() Node {<br>
&gt; +           case itemText:<br>
&gt; +                       return t.newText(token.pos, token.val)<br>
&gt; +           case itemLeftDelim:<br>
&gt; ++                     t.actionLine = token.line<br>
&gt; ++                     defer t.clearActionLine()<br>
&gt; +                       return t.action()<br>
&gt; +           case itemComment:<br>
&gt; +                       return t.newComment(token.pos, token.val)<br>
&gt; +@@ -359,6 +372,10 @@ func (t *Tree) textOrAction() Node {<br>
&gt; +           return nil<br>
&gt; + }<br>
&gt; +<br>
&gt; ++func (t *Tree) clearActionLine() {<br>
&gt; ++         t.actionLine = 0<br>
&gt; ++}<br>
&gt; ++<br>
&gt; + // Action:<br>
&gt; + //      control<br>
&gt; + //      command (&quot;|&quot; command)*<br>
&gt; +@@ -384,12 +401,12 @@ func (t *Tree) action() (n Node) {<br>
&gt; +           t.backup()<br>
&gt; +           token := t.peek()<br>
&gt; +           // Do not pop variables; they persist until &quot;end&quot;.<br>
&gt; +-         return t.newAction(token.pos, token.line, \
t.pipeline(&quot;command&quot;))<br> &gt; ++         return t.newAction(token.pos, \
token.line, t.pipeline(&quot;command&quot;, itemRightDelim))<br> &gt; + }<br>
&gt; +<br>
&gt; + // Pipeline:<br>
&gt; + //      declarations? command (&#39;|&#39; command)*<br>
&gt; +-func (t *Tree) pipeline(context string) (pipe *PipeNode) {<br>
&gt; ++func (t *Tree) pipeline(context string, end itemType) (pipe *PipeNode) {<br>
&gt; +           token := t.peekNonSpace()<br>
&gt; +           pipe = t.newPipeline(token.pos, token.line, nil)<br>
&gt; +           // Are there declarations or assignments?<br>
&gt; +@@ -430,12 +447,9 @@ decls:<br>
&gt; +           }<br>
&gt; +           for {<br>
&gt; +                       switch token := t.nextNonSpace(); token.typ {<br>
&gt; +-                     case itemRightDelim, itemRightParen:<br>
&gt; ++                     case end:<br>
&gt; +                                   // At this point, the pipeline is \
complete<br> &gt; +                                   t.checkPipeline(pipe, \
context)<br> &gt; +-                                 if token.typ == itemRightParen \
{<br> &gt; +-                                             t.backup()<br>
&gt; +-                                 }<br>
&gt; +                                   return<br>
&gt; +                       case itemBool, itemCharConstant, itemComplex, itemDot, \
itemField, itemIdentifier,<br> &gt; +                                   itemNumber, \
itemNil, itemRawString, itemString, itemVariable, itemLeftParen:<br> &gt; +@@ -464,7 \
+478,7 @@ func (t *Tree) checkPipeline(pipe *PipeNode, context string) {<br> &gt; \
+<br> &gt; + func (t *Tree) parseControl(allowElseIf bool, context string) (pos Pos, \
line int, pipe *PipeNode, list, elseList *ListNode) {<br> &gt; +           defer \
t.popVars(len(t.vars))<br> &gt; +-         pipe = t.pipeline(context)<br>
&gt; ++         pipe = t.pipeline(context, itemRightDelim)<br>
&gt; +           var next Node<br>
&gt; +           list, next = t.itemList()<br>
&gt; +           switch next.Type() {<br>
&gt; +@@ -550,7 +564,7 @@ func (t *Tree) blockControl() Node {<br>
&gt; +<br>
&gt; +           token := t.nextNonSpace()<br>
&gt; +           name := t.parseTemplateName(token, context)<br>
&gt; +-         pipe := t.pipeline(context)<br>
&gt; ++         pipe := t.pipeline(context, itemRightDelim)<br>
&gt; +<br>
&gt; +           block := New(name) // name will be updated once we know it.<br>
&gt; +           block.text = t.text<br>
&gt; +@@ -580,7 +594,7 @@ func (t *Tree) templateControl() Node {<br>
&gt; +           if t.nextNonSpace().typ != itemRightDelim {<br>
&gt; +                       t.backup()<br>
&gt; +                       // Do not pop variables; they persist until \
&quot;end&quot;.<br> &gt; +-                     pipe = t.pipeline(context)<br>
&gt; ++                     pipe = t.pipeline(context, itemRightDelim)<br>
&gt; +           }<br>
&gt; +           return t.newTemplate(token.pos, token.line, name, pipe)<br>
&gt; + }<br>
&gt; +@@ -614,13 +628,12 @@ func (t *Tree) command() *CommandNode {<br>
&gt; +                       switch token := t.next(); token.typ {<br>
&gt; +                       case itemSpace:<br>
&gt; +                                   continue<br>
&gt; +-                     case itemError:<br>
&gt; +-                                 t.errorf(&quot;%s&quot;, token.val)<br>
&gt; +                       case itemRightDelim, itemRightParen:<br>
&gt; +                                   t.backup()<br>
&gt; +                       case itemPipe:<br>
&gt; ++                                 // nothing here; break loop below<br>
&gt; +                       default:<br>
&gt; +-                                 t.errorf(&quot;unexpected %s in \
operand&quot;, token)<br> &gt; ++                                 t.unexpected(token, \
&quot;operand&quot;)<br> &gt; +                       }<br>
&gt; +                       break<br>
&gt; +           }<br>
&gt; +@@ -675,8 +688,6 @@ func (t *Tree) operand() Node {<br>
&gt; + // A nil return means the next item is not a term.<br>
&gt; + func (t *Tree) term() Node {<br>
&gt; +           switch token := t.nextNonSpace(); token.typ {<br>
&gt; +-         case itemError:<br>
&gt; +-                     t.errorf(&quot;%s&quot;, token.val)<br>
&gt; +           case itemIdentifier:<br>
&gt; +                       if !t.hasFunction(token.val) {<br>
&gt; +                                   t.errorf(&quot;function %q not \
defined&quot;, token.val)<br> &gt; +@@ -699,11 +710,7 @@ func (t *Tree) term() Node \
{<br> &gt; +                       }<br>
&gt; +                       return number<br>
&gt; +           case itemLeftParen:<br>
&gt; +-                     pipe := t.pipeline(&quot;parenthesized \
pipeline&quot;)<br> &gt; +-                     if token := t.next(); token.typ != \
itemRightParen {<br> &gt; +-                                 t.errorf(&quot;unclosed \
right paren: unexpected %s&quot;, token)<br> &gt; +-                     }<br>
&gt; +-                     return pipe<br>
&gt; ++                     return t.pipeline(&quot;parenthesized pipeline&quot;, \
itemRightParen)<br> &gt; +           case itemString, itemRawString:<br>
&gt; +                       s, err := strconv.Unquote(token.val)<br>
&gt; +                       if err != nil {<br>
&gt; +diff --git a/src/text/template/parse/parse_test.go \
b/src/text/template/parse/parse_test.go<br> &gt; +index d9c13c5..220f984 100644<br>
&gt; +--- a/src/text/template/parse/parse_test.go<br>
&gt; ++++ b/src/text/template/parse/parse_test.go<br>
&gt; +@@ -250,6 +250,13 @@ var parseTests = []parseTest{<br>
&gt; +           {&quot;comment trim left and right&quot;, &quot;x \r\n\t{{- /* */ \
-}}\n\n\ty&quot;, noError, `&quot;x&quot;&quot;y&quot;`},<br> &gt; +           \
{&quot;block definition&quot;, `{{block &quot;foo&quot; .}}hello{{end}}`, \
noError,<br> &gt; +                       `{{template &quot;foo&quot; .}}`},<br>
&gt; ++<br>
&gt; ++         {&quot;newline in assignment&quot;, &quot;{{ $x \n := \n 1 \n \
}}&quot;, noError, &quot;{{$x := 1}}&quot;},<br> &gt; ++         {&quot;newline in \
empty action&quot;, &quot;{{\n}}&quot;, hasError, &quot;{{\n}}&quot;},<br> &gt; ++    \
{&quot;newline in pipeline&quot;, &quot;{{\n\&quot;x\&quot;\n|\nprintf\n}}&quot;, \
noError, `{{&quot;x&quot; | printf}}`},<br> &gt; ++         {&quot;newline in \
comment&quot;, &quot;{{/*\nhello\n*/}}&quot;, noError, &quot;&quot;},<br> &gt; ++     \
{&quot;newline in comment&quot;, &quot;{{-\n/*\nhello\n*/\n-}}&quot;, noError, \
&quot;&quot;},<br> &gt; ++<br>
&gt; +           // Errors.<br>
&gt; +           {&quot;unclosed action&quot;, &quot;hello{{range&quot;, hasError, \
&quot;&quot;},<br> &gt; +           {&quot;unmatched end&quot;, &quot;{{end}}&quot;, \
hasError, &quot;&quot;},<br> &gt; +@@ -426,23 +433,38 @@ var errorTests = \
[]parseTest{<br> &gt; +           // Check line numbers are accurate.<br>
&gt; +           {&quot;unclosed1&quot;,<br>
&gt; +                       &quot;line1\n{{&quot;,<br>
&gt; +-                     hasError, `unclosed1:2: unexpected unclosed action in \
command`},<br> &gt; ++                     hasError, `unclosed1:2: unclosed \
action`},<br> &gt; +           {&quot;unclosed2&quot;,<br>
&gt; +                       &quot;line1\n{{define `x`}}line2\n{{&quot;,<br>
&gt; +-                     hasError, `unclosed2:3: unexpected unclosed action in \
command`},<br> &gt; ++                     hasError, `unclosed2:3: unclosed \
action`},<br> &gt; ++         {&quot;unclosed3&quot;,<br>
&gt; ++                     \
&quot;line1\n{{\&quot;x\&quot;\n\&quot;y\&quot;\n&quot;,<br> &gt; ++                  \
hasError, `unclosed3:4: unclosed action started at unclosed3:2`},<br> &gt; ++         \
{&quot;unclosed4&quot;,<br> &gt; ++                     &quot;{{\n\n\n\n\n&quot;,<br>
&gt; ++                     hasError, `unclosed4:6: unclosed action started at \
unclosed4:1`},<br> &gt; ++         {&quot;var1&quot;,<br>
&gt; ++                     &quot;line1\n{{\nx\n}}&quot;,<br>
&gt; ++                     hasError, `var1:3: function &quot;x&quot; not \
defined`},<br> &gt; +           // Specific errors.<br>
&gt; +           {&quot;function&quot;,<br>
&gt; +                       &quot;{{foo}}&quot;,<br>
&gt; +                       hasError, `function &quot;foo&quot; not defined`},<br>
&gt; +-         {&quot;comment&quot;,<br>
&gt; ++         {&quot;comment1&quot;,<br>
&gt; +                       &quot;{{/*}}&quot;,<br>
&gt; +-                     hasError, `unclosed comment`},<br>
&gt; ++                     hasError, `comment1:1: unclosed comment`},<br>
&gt; ++         {&quot;comment2&quot;,<br>
&gt; ++                     &quot;{{/*\nhello\n}}&quot;,<br>
&gt; ++                     hasError, `comment2:1: unclosed comment`},<br>
&gt; +           {&quot;lparen&quot;,<br>
&gt; +                       &quot;{{.X (1 2 3}}&quot;,<br>
&gt; +                       hasError, `unclosed left paren`},<br>
&gt; +           {&quot;rparen&quot;,<br>
&gt; +-                     &quot;{{.X 1 2 3)}}&quot;,<br>
&gt; +-                     hasError, `unexpected &quot;)&quot;`},<br>
&gt; ++                     &quot;{{.X 1 2 3 ) }}&quot;,<br>
&gt; ++                     hasError, `unexpected &quot;)&quot; in command`},<br>
&gt; ++         {&quot;rparen2&quot;,<br>
&gt; ++                     &quot;{{(.X 1 2 3&quot;,<br>
&gt; ++                     hasError, `unclosed action`},<br>
&gt; +           {&quot;space&quot;,<br>
&gt; +                       &quot;{{`x`3}}&quot;,<br>
&gt; +                       hasError, `in operand`},<br>
&gt; +@@ -488,7 +510,7 @@ var errorTests = []parseTest{<br>
&gt; +                       hasError, `missing value for parenthesized \
pipeline`},<br> &gt; +           {&quot;multilinerawstring&quot;,<br>
&gt; +                       &quot;{{ $v := `\n` }} {{&quot;,<br>
&gt; +-                     hasError, `multilinerawstring:2: unexpected unclosed \
action`},<br> &gt; ++                     hasError, `multilinerawstring:2: unclosed \
action`},<br> &gt; +           {&quot;rangeundefvar&quot;,<br>
&gt; +                       &quot;{{range $k}}{{end}}&quot;,<br>
&gt; +                       hasError, `undefined variable`},<br>
&gt; +--<br>
&gt; +2.7.4<br>
&gt; diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_5.patch \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_5.patch<br> &gt; new file mode \
100644<br> &gt; index 0000000000..fc38929648<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_5.patch<br>
&gt; @@ -0,0 +1,585 @@<br>
&gt; +From e0e6bca6ddc0e6d9fa3a5b644af9b446924fbf83 Mon Sep 17 00:00:00 2001<br>
&gt; +From: Russ Cox &lt;<a href="mailto:rsc@golang.org" \
target="_blank">rsc@golang.org</a>&gt;<br> &gt; +Date: Thu, 20 May 2021 12:46:33 \
-0400<br> &gt; +Subject: [PATCH 5/6] html/template, text/template: implement break \
and<br> &gt; + continue for range loops<br>
&gt; +<br>
&gt; +Break and continue for range loops was accepted as a proposal in June 2017.<br>
&gt; +It was implemented in CL 66410 (Oct 2017)<br>
&gt; +but then rolled back in CL 92155 (Feb 2018)<br>
&gt; +because html/template changes had not been implemented.<br>
&gt; +<br>
&gt; +This CL reimplements break and continue in text/template<br>
&gt; +and then adds support for them in html/template as well.<br>
&gt; +<br>
&gt; +Fixes #20531.<br>
&gt; +<br>
&gt; +Change-Id: I05330482a976f1c078b4b49c2287bd9031bb7616<br>
&gt; +Reviewed-on: <a href="https://go-review.googlesource.com/c/go/+/321491" \
rel="noreferrer" target="_blank">https://go-review.googlesource.com/c/go/+/321491</a><br>
 &gt; +Trust: Russ Cox &lt;<a href="mailto:rsc@golang.org" \
target="_blank">rsc@golang.org</a>&gt;<br> &gt; +Run-TryBot: Russ Cox &lt;<a \
href="mailto:rsc@golang.org" target="_blank">rsc@golang.org</a>&gt;<br> &gt; \
+TryBot-Result: Go Bot &lt;<a href="mailto:gobot@golang.org" \
target="_blank">gobot@golang.org</a>&gt;<br> &gt; +Reviewed-by: Rob Pike &lt;<a \
href="mailto:r@golang.org" target="_blank">r@golang.org</a>&gt;<br> &gt; +<br>
&gt; +Dependency Patch #5<br>
&gt; +<br>
&gt; +Upstream-Status: Backport from <a \
href="https://github.com/golang/go/commit/d0dd26a88c019d54f22463daae81e785f5867565" \
rel="noreferrer" target="_blank">https://github.com/golang/go/commit/d0dd26a88c019d54f22463daae81e785f5867565</a><br>
 &gt; +CVE: CVE-2023-24538<br>
&gt; +Signed-off-by: Shubham Kulkarni &lt;<a href="mailto:skulkarni@mvista.com" \
target="_blank">skulkarni@mvista.com</a>&gt;<br> &gt; +---<br>
&gt; + src/html/template/context.go               |   4 ++<br>
&gt; + src/html/template/escape.go                 | 71 \
++++++++++++++++++++++++++++++++++-<br> &gt; + src/html/template/escape_test.go       \
| 24 ++++++++++++<br> &gt; + src/text/template/doc.go                     |   8 \
++++<br> &gt; + src/text/template/exec.go                    | 24 +++++++++++-<br>
&gt; + src/text/template/exec_test.go            |   2 +<br>
&gt; + src/text/template/parse/lex.go            | 13 ++++++-<br>
&gt; + src/text/template/parse/lex_test.go     |   2 +<br>
&gt; + src/text/template/parse/node.go           | 36 ++++++++++++++++++<br>
&gt; + src/text/template/parse/parse.go         | 42 ++++++++++++++++++++-<br>
&gt; + src/text/template/parse/parse_test.go |   8 ++++<br>
&gt; + 11 files changed, 230 insertions(+), 4 deletions(-)<br>
&gt; +<br>
&gt; +diff --git a/src/html/template/context.go b/src/html/template/context.go<br>
&gt; +index f7d4849..aaa7d08 100644<br>
&gt; +--- a/src/html/template/context.go<br>
&gt; ++++ b/src/html/template/context.go<br>
&gt; +@@ -6,6 +6,7 @@ package template<br>
&gt; +<br>
&gt; + import (<br>
&gt; +           &quot;fmt&quot;<br>
&gt; ++         &quot;text/template/parse&quot;<br>
&gt; + )<br>
&gt; +<br>
&gt; + // context describes the state an HTML parser must be in when it reaches \
the<br> &gt; +@@ -22,6 +23,7 @@ type context struct {<br>
&gt; +           jsCtx     jsCtx<br>
&gt; +           attr      attr<br>
&gt; +           element element<br>
&gt; ++         n           parse.Node // for range break/continue<br>
&gt; +           err        *Error<br>
&gt; + }<br>
&gt; +<br>
&gt; +@@ -141,6 +143,8 @@ const (<br>
&gt; +           // stateError is an infectious error state outside any valid<br>
&gt; +           // HTML/CSS/JS construct.<br>
&gt; +           stateError<br>
&gt; ++         // stateDead marks unreachable code after a {{break}} or \
{{continue}}.<br> &gt; ++         stateDead<br>
&gt; + )<br>
&gt; +<br>
&gt; + // isComment is true for any state that contains content meant for \
template<br> &gt; +diff --git a/src/html/template/escape.go \
b/src/html/template/escape.go<br> &gt; +index 8739735..6dea79c 100644<br>
&gt; +--- a/src/html/template/escape.go<br>
&gt; ++++ b/src/html/template/escape.go<br>
&gt; +@@ -97,6 +97,15 @@ type escaper struct {<br>
&gt; +           actionNodeEdits     map[*parse.ActionNode][]string<br>
&gt; +           templateNodeEdits map[*parse.TemplateNode]string<br>
&gt; +           textNodeEdits        map[*parse.TextNode][]byte<br>
&gt; ++         // rangeContext holds context about the current range loop.<br>
&gt; ++         rangeContext *rangeContext<br>
&gt; ++}<br>
&gt; ++<br>
&gt; ++// rangeContext holds information about the current range loop.<br>
&gt; ++type rangeContext struct {<br>
&gt; ++         outer        *rangeContext // outer loop<br>
&gt; ++         breaks      []context        // context at each break action<br>
&gt; ++         continues []context        // context at each continue action<br>
&gt; + }<br>
&gt; +<br>
&gt; + // makeEscaper creates a blank escaper for the given set.<br>
&gt; +@@ -109,6 +118,7 @@ func makeEscaper(n *nameSpace) escaper {<br>
&gt; +                       map[*parse.ActionNode][]string{},<br>
&gt; +                       map[*parse.TemplateNode]string{},<br>
&gt; +                       map[*parse.TextNode][]byte{},<br>
&gt; ++                     nil,<br>
&gt; +           }<br>
&gt; + }<br>
&gt; +<br>
&gt; +@@ -124,8 +134,16 @@ func (e *escaper) escape(c context, n parse.Node) context \
{<br> &gt; +           switch n := n.(type) {<br>
&gt; +           case *parse.ActionNode:<br>
&gt; +                       return e.escapeAction(c, n)<br>
&gt; ++         case *parse.BreakNode:<br>
&gt; ++                     c.n = n<br>
&gt; ++                     e.rangeContext.breaks = append(e.rangeContext.breaks, \
c)<br> &gt; ++                     return context{state: stateDead}<br>
&gt; +           case *parse.CommentNode:<br>
&gt; +                       return c<br>
&gt; ++         case *parse.ContinueNode:<br>
&gt; ++                     c.n = n<br>
&gt; ++                     e.rangeContext.continues = append(e.rangeContext.breaks, \
c)<br> &gt; ++                     return context{state: stateDead}<br>
&gt; +           case *parse.IfNode:<br>
&gt; +                       return e.escapeBranch(c, &amp;n.BranchNode, \
&quot;if&quot;)<br> &gt; +           case *parse.ListNode:<br>
&gt; +@@ -427,6 +445,12 @@ func join(a, b context, node parse.Node, nodeName string) \
context {<br> &gt; +           if b.state == stateError {<br>
&gt; +                       return b<br>
&gt; +           }<br>
&gt; ++         if a.state == stateDead {<br>
&gt; ++                     return b<br>
&gt; ++         }<br>
&gt; ++         if b.state == stateDead {<br>
&gt; ++                     return a<br>
&gt; ++         }<br>
&gt; +           if a.eq(b) {<br>
&gt; +                       return a<br>
&gt; +           }<br>
&gt; +@@ -466,14 +490,27 @@ func join(a, b context, node parse.Node, nodeName string) \
context {<br> &gt; +<br>
&gt; + // escapeBranch escapes a branch template node: &quot;if&quot;, \
&quot;range&quot; and &quot;with&quot;.<br> &gt; + func (e *escaper) escapeBranch(c \
context, n *parse.BranchNode, nodeName string) context {<br> &gt; ++         if \
nodeName == &quot;range&quot; {<br> &gt; ++                     e.rangeContext = \
&amp;rangeContext{outer: e.rangeContext}<br> &gt; ++         }<br>
&gt; +           c0 := e.escapeList(c, n.List)<br>
&gt; +-         if nodeName == &quot;range&quot; &amp;&amp; c0.state != stateError \
{<br> &gt; ++         if nodeName == &quot;range&quot; {<br>
&gt; ++                     if c0.state != stateError {<br>
&gt; ++                                 c0 = joinRange(c0, e.rangeContext)<br>
&gt; ++                     }<br>
&gt; ++                     e.rangeContext = e.rangeContext.outer<br>
&gt; ++                     if c0.state == stateError {<br>
&gt; ++                                 return c0<br>
&gt; ++                     }<br>
&gt; ++<br>
&gt; +                       // The &quot;true&quot; branch of a &quot;range&quot; \
node can execute multiple times.<br> &gt; +                       // We check that \
executing n.List once results in the same context<br> &gt; +                       // \
as executing n.List twice.<br> &gt; ++                     e.rangeContext = \
&amp;rangeContext{outer: e.rangeContext}<br> &gt; +                       c1, _ := \
e.escapeListConditionally(c0, n.List, nil)<br> &gt; +                       c0 = \
join(c0, c1, n, nodeName)<br> &gt; +                       if c0.state == stateError \
{<br> &gt; ++                                 e.rangeContext = \
e.rangeContext.outer<br> &gt; +                                   // Make clear that \
this is a problem on loop re-entry<br> &gt; +                                   // \
since developers tend to overlook that branch when<br> &gt; +                         \
// debugging templates.<br> &gt; +@@ -481,11 +518,39 @@ func (e *escaper) \
escapeBranch(c context, n *parse.BranchNode, nodeName string)<br> &gt; +              \
c0.err.Description = &quot;on range loop re-entry: &quot; + c0.err.Description<br> \
&gt; +                                   return c0<br> &gt; +                       \
}<br> &gt; ++                     c0 = joinRange(c0, e.rangeContext)<br>
&gt; ++                     e.rangeContext = e.rangeContext.outer<br>
&gt; ++                     if c0.state == stateError {<br>
&gt; ++                                 return c0<br>
&gt; ++                     }<br>
&gt; +           }<br>
&gt; +           c1 := e.escapeList(c, n.ElseList)<br>
&gt; +           return join(c0, c1, n, nodeName)<br>
&gt; + }<br>
&gt; +<br>
&gt; ++func joinRange(c0 context, rc *rangeContext) context {<br>
&gt; ++         // Merge contexts at break and continue statements into overall body \
context.<br> &gt; ++         // In theory we could treat breaks differently from \
continues, but for now it is<br> &gt; ++         // enough to treat them both as \
going back to the start of the loop (which may then stop).<br> &gt; ++         for _, \
c := range rc.breaks {<br> &gt; ++                     c0 = join(c0, c, c.n, \
&quot;range&quot;)<br> &gt; ++                     if c0.state == stateError {<br>
&gt; ++                                 c0.err.Line = c.n.(*parse.BreakNode).Line<br>
&gt; ++                                 c0.err.Description = &quot;at range loop \
break: &quot; + c0.err.Description<br> &gt; ++                                 return \
c0<br> &gt; ++                     }<br>
&gt; ++         }<br>
&gt; ++         for _, c := range rc.continues {<br>
&gt; ++                     c0 = join(c0, c, c.n, &quot;range&quot;)<br>
&gt; ++                     if c0.state == stateError {<br>
&gt; ++                                 c0.err.Line = \
c.n.(*parse.ContinueNode).Line<br> &gt; ++                                 \
c0.err.Description = &quot;at range loop continue: &quot; + c0.err.Description<br> \
&gt; ++                                 return c0<br> &gt; ++                     \
}<br> &gt; ++         }<br>
&gt; ++         return c0<br>
&gt; ++}<br>
&gt; ++<br>
&gt; + // escapeList escapes a list template node.<br>
&gt; + func (e *escaper) escapeList(c context, n *parse.ListNode) context {<br>
&gt; +           if n == nil {<br>
&gt; +@@ -493,6 +558,9 @@ func (e *escaper) escapeList(c context, n *parse.ListNode) \
context {<br> &gt; +           }<br>
&gt; +           for _, m := range n.Nodes {<br>
&gt; +                       c = e.escape(c, m)<br>
&gt; ++                     if c.state == stateDead {<br>
&gt; ++                                 break<br>
&gt; ++                     }<br>
&gt; +           }<br>
&gt; +           return c<br>
&gt; + }<br>
&gt; +@@ -503,6 +571,7 @@ func (e *escaper) escapeList(c context, n *parse.ListNode) \
context {<br> &gt; + // which is the same as whether e was updated.<br>
&gt; + func (e *escaper) escapeListConditionally(c context, n *parse.ListNode, filter \
func(*escaper, context) bool) (context, bool) {<br> &gt; +           e1 := \
makeEscaper(e.ns)<br> &gt; ++         e1.rangeContext = e.rangeContext<br>
&gt; +           // Make type inferences available to f.<br>
&gt; +           for k, v := range e.output {<br>
&gt; +                       e1.output[k] = v<br>
&gt; +diff --git a/src/html/template/escape_test.go \
b/src/html/template/escape_test.go<br> &gt; +index c709660..fa2b84a 100644<br>
&gt; +--- a/src/html/template/escape_test.go<br>
&gt; ++++ b/src/html/template/escape_test.go<br>
&gt; +@@ -920,6 +920,22 @@ func TestErrors(t *testing.T) {<br>
&gt; +                                   &quot;&lt;a href=&#39;/foo?{{range \
.Items}}&amp;{{.K}}={{.V}}{{end}}&#39;&gt;&quot;,<br> &gt; +                          \
&quot;&quot;,<br> &gt; +                       },<br>
&gt; ++                     {<br>
&gt; ++                                 &quot;{{range .Items}}&lt;a{{if \
.X}}{{end}}&gt;{{end}}&quot;,<br> &gt; ++                                 \
&quot;&quot;,<br> &gt; ++                     },<br>
&gt; ++                     {<br>
&gt; ++                                 &quot;{{range .Items}}&lt;a{{if \
.X}}{{end}}&gt;{{continue}}{{end}}&quot;,<br> &gt; ++                                 \
&quot;&quot;,<br> &gt; ++                     },<br>
&gt; ++                     {<br>
&gt; ++                                 &quot;{{range .Items}}&lt;a{{if \
.X}}{{end}}&gt;{{break}}{{end}}&quot;,<br> &gt; ++                                 \
&quot;&quot;,<br> &gt; ++                     },<br>
&gt; ++                     {<br>
&gt; ++                                 &quot;{{range .Items}}&lt;a{{if \
.X}}{{end}}&gt;{{if .X}}{{break}}{{end}}{{end}}&quot;,<br> &gt; ++                    \
&quot;&quot;,<br> &gt; ++                     },<br>
&gt; +                       // Error cases.<br>
&gt; +                       {<br>
&gt; +                                   &quot;{{if .Cond}}&lt;a{{end}}&quot;,<br>
&gt; +@@ -956,6 +972,14 @@ func TestErrors(t *testing.T) {<br>
&gt; +                                   &quot;z:2:8: on range loop re-entry: \
{{range}} branches&quot;,<br> &gt; +                       },<br>
&gt; +                       {<br>
&gt; ++                                 &quot;{{range .Items}}&lt;a{{if \
.X}}{{break}}{{end}}&gt;{{end}}&quot;,<br> &gt; ++                                 \
&quot;z:1:29: at range loop break: {{range}} branches end in different \
contexts&quot;,<br> &gt; ++                     },<br>
&gt; ++                     {<br>
&gt; ++                                 &quot;{{range .Items}}&lt;a{{if \
.X}}{{continue}}{{end}}&gt;{{end}}&quot;,<br> &gt; ++                                 \
&quot;z:1:29: at range loop continue: {{range}} branches end in different \
contexts&quot;,<br> &gt; ++                     },<br>
&gt; ++                     {<br>
&gt; +                                   &quot;&lt;a b=1 c={{.H}}&quot;,<br>
&gt; +                                   &quot;z: ends in a non-text context: \
{stateAttr delimSpaceOrTagEnd&quot;,<br> &gt; +                       },<br>
&gt; +diff --git a/src/text/template/doc.go b/src/text/template/doc.go<br>
&gt; +index 7b30294..0228b15 100644<br>
&gt; +--- a/src/text/template/doc.go<br>
&gt; ++++ b/src/text/template/doc.go<br>
&gt; +@@ -112,6 +112,14 @@ data, defined in detail in the corresponding sections that \
follow.<br> &gt; +                       T0 is executed; otherwise, dot is set to the \
successive elements<br> &gt; +                       of the array, slice, or map and \
T1 is executed.<br> &gt; +<br>
&gt; ++         {{break}}<br>
&gt; ++                     The innermost {{range pipeline}} loop is ended early, \
stopping the<br> &gt; ++                     current iteration and bypassing all \
remaining iterations.<br> &gt; ++<br>
&gt; ++         {{continue}}<br>
&gt; ++                     The current iteration of the innermost {{range pipeline}} \
loop is<br> &gt; ++                     stopped, and the loop starts the next \
iteration.<br> &gt; ++<br>
&gt; +           {{template &quot;name&quot;}}<br>
&gt; +                       The template with the specified name is executed with \
nil data.<br> &gt; +<br>
&gt; +diff --git a/src/text/template/exec.go b/src/text/template/exec.go<br>
&gt; +index 7ac5175..6cb140a 100644<br>
&gt; +--- a/src/text/template/exec.go<br>
&gt; ++++ b/src/text/template/exec.go<br>
&gt; +@@ -5,6 +5,7 @@<br>
&gt; + package template<br>
&gt; +<br>
&gt; + import (<br>
&gt; ++         &quot;errors&quot;<br>
&gt; +           &quot;fmt&quot;<br>
&gt; +           &quot;internal/fmtsort&quot;<br>
&gt; +           &quot;io&quot;<br>
&gt; +@@ -244,6 +245,12 @@ func (t *Template) DefinedTemplates() string {<br>
&gt; +           return b.String()<br>
&gt; + }<br>
&gt; +<br>
&gt; ++// Sentinel errors for use with panic to signal early exits from range \
loops.<br> &gt; ++var (<br>
&gt; ++         walkBreak      = errors.New(&quot;break&quot;)<br>
&gt; ++         walkContinue = errors.New(&quot;continue&quot;)<br>
&gt; ++)<br>
&gt; ++<br>
&gt; + // Walk functions step through the major pieces of the template structure,<br>
&gt; + // generating output as they go.<br>
&gt; + func (s *state) walk(dot reflect.Value, node parse.Node) {<br>
&gt; +@@ -256,7 +263,11 @@ func (s *state) walk(dot reflect.Value, node parse.Node) \
{<br> &gt; +                       if len(node.Pipe.Decl) == 0 {<br>
&gt; +                                   s.printValue(node, val)<br>
&gt; +                       }<br>
&gt; ++         case *parse.BreakNode:<br>
&gt; ++                     panic(walkBreak)<br>
&gt; +           case *parse.CommentNode:<br>
&gt; ++         case *parse.ContinueNode:<br>
&gt; ++                     panic(walkContinue)<br>
&gt; +           case *parse.IfNode:<br>
&gt; +                       s.walkIfOrWith(parse.NodeIf, dot, node.Pipe, node.List, \
node.ElseList)<br> &gt; +           case *parse.ListNode:<br>
&gt; +@@ -335,6 +346,11 @@ func isTrue(val reflect.Value) (truth, ok bool) {<br>
&gt; +<br>
&gt; + func (s *state) walkRange(dot reflect.Value, r *parse.RangeNode) {<br>
&gt; +           <a href="http://s.at" rel="noreferrer" \
target="_blank">s.at</a>(r)<br> &gt; ++         defer func() {<br>
&gt; ++                     if r := recover(); r != nil &amp;&amp; r != walkBreak \
{<br> &gt; ++                                 panic(r)<br>
&gt; ++                     }<br>
&gt; ++         }()<br>
&gt; +           defer s.pop(s.mark())<br>
&gt; +           val, _ := indirect(s.evalPipeline(dot, r.Pipe))<br>
&gt; +           // mark top of stack before any variables in the body are \
pushed.<br> &gt; +@@ -348,8 +364,14 @@ func (s *state) walkRange(dot reflect.Value, r \
*parse.RangeNode) {<br> &gt; +                       if len(r.Pipe.Decl) &gt; 1 {<br>
&gt; +                                   s.setTopVar(2, index)<br>
&gt; +                       }<br>
&gt; ++                     defer s.pop(mark)<br>
&gt; ++                     defer func() {<br>
&gt; ++                                 // Consume panic(walkContinue)<br>
&gt; ++                                 if r := recover(); r != nil &amp;&amp; r != \
walkContinue {<br> &gt; ++                                             panic(r)<br>
&gt; ++                                 }<br>
&gt; ++                     }()<br>
&gt; +                       s.walk(elem, r.List)<br>
&gt; +-                     s.pop(mark)<br>
&gt; +           }<br>
&gt; +           switch val.Kind() {<br>
&gt; +           case reflect.Array, reflect.Slice:<br>
&gt; +diff --git a/src/text/template/exec_test.go \
b/src/text/template/exec_test.go<br> &gt; +index 3309b33..a639f44 100644<br>
&gt; +--- a/src/text/template/exec_test.go<br>
&gt; ++++ b/src/text/template/exec_test.go<br>
&gt; +@@ -563,6 +563,8 @@ var execTests = []execTest{<br>
&gt; +           {&quot;range empty no else&quot;, &quot;{{range \
.SIEmpty}}-{{.}}-{{end}}&quot;, &quot;&quot;, tVal, true},<br> &gt; +           \
{&quot;range []int else&quot;, &quot;{{range .SI}}-{{.}}-{{else}}EMPTY{{end}}&quot;, \
&quot;-3--4--5-&quot;, tVal, true},<br> &gt; +           {&quot;range empty \
else&quot;, &quot;{{range .SIEmpty}}-{{.}}-{{else}}EMPTY{{end}}&quot;, \
&quot;EMPTY&quot;, tVal, true},<br> &gt; ++         {&quot;range []int break \
else&quot;, &quot;{{range .SI}}-{{.}}-{{break}}NOTREACHED{{else}}EMPTY{{end}}&quot;, \
&quot;-3-&quot;, tVal, true},<br> &gt; ++         {&quot;range []int continue \
else&quot;, &quot;{{range \
.SI}}-{{.}}-{{continue}}NOTREACHED{{else}}EMPTY{{end}}&quot;, &quot;-3--4--5-&quot;, \
tVal, true},<br> &gt; +           {&quot;range []bool&quot;, &quot;{{range \
.SB}}-{{.}}-{{end}}&quot;, &quot;-true--false-&quot;, tVal, true},<br> &gt; +         \
{&quot;range []int method&quot;, &quot;{{range .SI | .MAdd .I}}-{{.}}-{{end}}&quot;, \
&quot;-20--21--22-&quot;, tVal, true},<br> &gt; +           {&quot;range map&quot;, \
&quot;{{range .MSI}}-{{.}}-{{end}}&quot;, &quot;-1--3--2-&quot;, tVal, true},<br> \
&gt; +diff --git a/src/text/template/parse/lex.go \
b/src/text/template/parse/lex.go<br> &gt; +index 6784071..95e3377 100644<br>
&gt; +--- a/src/text/template/parse/lex.go<br>
&gt; ++++ b/src/text/template/parse/lex.go<br>
&gt; +@@ -62,6 +62,8 @@ const (<br>
&gt; +           // Keywords appear after all the rest.<br>
&gt; +           itemKeyword   // used only to delimit the keywords<br>
&gt; +           itemBlock      // block keyword<br>
&gt; ++         itemBreak      // break keyword<br>
&gt; ++         itemContinue // continue keyword<br>
&gt; +           itemDot         // the cursor, spelled &#39;.&#39;<br>
&gt; +           itemDefine     // define keyword<br>
&gt; +           itemElse        // else keyword<br>
&gt; +@@ -76,6 +78,8 @@ const (<br>
&gt; + var key = map[string]itemType{<br>
&gt; +           &quot;.&quot;:            itemDot,<br>
&gt; +           &quot;block&quot;:      itemBlock,<br>
&gt; ++         &quot;break&quot;:      itemBreak,<br>
&gt; ++         &quot;continue&quot;: itemContinue,<br>
&gt; +           &quot;define&quot;:     itemDefine,<br>
&gt; +           &quot;else&quot;:        itemElse,<br>
&gt; +           &quot;end&quot;:         itemEnd,<br>
&gt; +@@ -119,6 +123,8 @@ type lexer struct {<br>
&gt; +           parenDepth   int           // nesting depth of ( ) exprs<br>
&gt; +           line            int           // 1+number of newlines seen<br>
&gt; +           startLine     int           // start line of this item<br>
&gt; ++         breakOK        bool         // break keyword allowed<br>
&gt; ++         continueOK   bool         // continue keyword allowed<br>
&gt; + }<br>
&gt; +<br>
&gt; + // next returns the next rune in the input.<br>
&gt; +@@ -461,7 +467,12 @@ Loop:<br>
&gt; +                                   }<br>
&gt; +                                   switch {<br>
&gt; +                                   case key[word] &gt; itemKeyword:<br>
&gt; +-                                             l.emit(key[word])<br>
&gt; ++                                             item := key[word]<br>
&gt; ++                                             if item == itemBreak &amp;&amp; \
!l.breakOK || item == itemContinue &amp;&amp; !l.continueOK {<br> &gt; ++             \
l.emit(itemIdentifier)<br> &gt; ++                                             } else \
{<br> &gt; ++                                                         \
l.emit(item)<br> &gt; ++                                             }<br>
&gt; +                                   case word[0] == &#39;.&#39;:<br>
&gt; +                                               l.emit(itemField)<br>
&gt; +                                   case word == &quot;true&quot;, word == \
&quot;false&quot;:<br> &gt; +diff --git a/src/text/template/parse/lex_test.go \
b/src/text/template/parse/lex_test.go<br> &gt; +index 6510eed..df6aabf 100644<br>
&gt; +--- a/src/text/template/parse/lex_test.go<br>
&gt; ++++ b/src/text/template/parse/lex_test.go<br>
&gt; +@@ -35,6 +35,8 @@ var itemName = map[itemType]string{<br>
&gt; +           // keywords<br>
&gt; +           itemDot:         &quot;.&quot;,<br>
&gt; +           itemBlock:      &quot;block&quot;,<br>
&gt; ++         itemBreak:      &quot;break&quot;,<br>
&gt; ++         itemContinue: &quot;continue&quot;,<br>
&gt; +           itemDefine:     &quot;define&quot;,<br>
&gt; +           itemElse:        &quot;else&quot;,<br>
&gt; +           itemIf:           &quot;if&quot;,<br>
&gt; +diff --git a/src/text/template/parse/node.go \
b/src/text/template/parse/node.go<br> &gt; +index a9dad5e..c398da0 100644<br>
&gt; +--- a/src/text/template/parse/node.go<br>
&gt; ++++ b/src/text/template/parse/node.go<br>
&gt; +@@ -71,6 +71,8 @@ const (<br>
&gt; +           NodeVariable                             // A $ variable.<br>
&gt; +           NodeWith                                   // A with action.<br>
&gt; +           NodeComment                              // A comment.<br>
&gt; ++         NodeBreak                                 // A break action.<br>
&gt; ++         NodeContinue                             // A continue action.<br>
&gt; + )<br>
&gt; +<br>
&gt; + // Nodes.<br>
&gt; +@@ -907,6 +909,40 @@ func (i *IfNode) Copy() Node {<br>
&gt; +           return i.tr.newIf(i.Pos, i.Line, i.Pipe.CopyPipe(), \
i.List.CopyList(), i.ElseList.CopyList())<br> &gt; + }<br>
&gt; +<br>
&gt; ++// BreakNode represents a {{break}} action.<br>
&gt; ++type BreakNode struct {<br>
&gt; ++         tr *Tree<br>
&gt; ++         NodeType<br>
&gt; ++         Pos<br>
&gt; ++         Line int<br>
&gt; ++}<br>
&gt; ++<br>
&gt; ++func (t *Tree) newBreak(pos Pos, line int) *BreakNode {<br>
&gt; ++         return &amp;BreakNode{tr: t, NodeType: NodeBreak, Pos: pos, Line: \
line}<br> &gt; ++}<br>
&gt; ++<br>
&gt; ++func (b *BreakNode) Copy() Node                           { return \
b.tr.newBreak(b.Pos, b.Line) }<br> &gt; ++func (b *BreakNode) String() string         \
{ return &quot;{{break}}&quot; }<br> &gt; ++func (b *BreakNode) tree() *Tree          \
{ return <a href="http://b.tr" rel="noreferrer" target="_blank">b.tr</a> }<br> &gt; \
++func (b *BreakNode) writeTo(sb *strings.Builder) { \
sb.WriteString(&quot;{{break}}&quot;) }<br> &gt; ++<br>
&gt; ++// ContinueNode represents a {{continue}} action.<br>
&gt; ++type ContinueNode struct {<br>
&gt; ++         tr *Tree<br>
&gt; ++         NodeType<br>
&gt; ++         Pos<br>
&gt; ++         Line int<br>
&gt; ++}<br>
&gt; ++<br>
&gt; ++func (t *Tree) newContinue(pos Pos, line int) *ContinueNode {<br>
&gt; ++         return &amp;ContinueNode{tr: t, NodeType: NodeContinue, Pos: pos, \
Line: line}<br> &gt; ++}<br>
&gt; ++<br>
&gt; ++func (c *ContinueNode) Copy() Node                           { return \
c.tr.newContinue(c.Pos, c.Line) }<br> &gt; ++func (c *ContinueNode) String() string   \
{ return &quot;{{continue}}&quot; }<br> &gt; ++func (c *ContinueNode) tree() *Tree    \
{ return <a href="http://c.tr" rel="noreferrer" target="_blank">c.tr</a> }<br> &gt; \
++func (c *ContinueNode) writeTo(sb *strings.Builder) { \
sb.WriteString(&quot;{{continue}}&quot;) }<br> &gt; ++<br>
&gt; + // RangeNode represents a {{range}} action and its commands.<br>
&gt; + type RangeNode struct {<br>
&gt; +           BranchNode<br>
&gt; +diff --git a/src/text/template/parse/parse.go \
b/src/text/template/parse/parse.go<br> &gt; +index 5e6e512..7f78b56 100644<br>
&gt; +--- a/src/text/template/parse/parse.go<br>
&gt; ++++ b/src/text/template/parse/parse.go<br>
&gt; +@@ -31,6 +31,7 @@ type Tree struct {<br>
&gt; +           vars           []string // variables defined at the moment.<br>
&gt; +           treeSet      map[string]*Tree<br>
&gt; +           actionLine int // line of left delim starting action<br>
&gt; ++         rangeDepth int<br>
&gt; +           mode           Mode<br>
&gt; + }<br>
&gt; +<br>
&gt; +@@ -223,6 +224,8 @@ func (t *Tree) startParse(funcs []map[string]interface{}, \
lex *lexer, treeSet ma<br> &gt; +           t.vars = []string{&quot;$&quot;}<br>
&gt; +           t.funcs = funcs<br>
&gt; +           t.treeSet = treeSet<br>
&gt; ++         lex.breakOK = !t.hasFunction(&quot;break&quot;)<br>
&gt; ++         lex.continueOK = !t.hasFunction(&quot;continue&quot;)<br>
&gt; + }<br>
&gt; +<br>
&gt; + // stopParse terminates parsing.<br>
&gt; +@@ -385,6 +388,10 @@ func (t *Tree) action() (n Node) {<br>
&gt; +           switch token := t.nextNonSpace(); token.typ {<br>
&gt; +           case itemBlock:<br>
&gt; +                       return t.blockControl()<br>
&gt; ++         case itemBreak:<br>
&gt; ++                     return t.breakControl(token.pos, token.line)<br>
&gt; ++         case itemContinue:<br>
&gt; ++                     return t.continueControl(token.pos, token.line)<br>
&gt; +           case itemElse:<br>
&gt; +                       return t.elseControl()<br>
&gt; +           case itemEnd:<br>
&gt; +@@ -404,6 +411,32 @@ func (t *Tree) action() (n Node) {<br>
&gt; +           return t.newAction(token.pos, token.line, \
t.pipeline(&quot;command&quot;, itemRightDelim))<br> &gt; + }<br>
&gt; +<br>
&gt; ++// Break:<br>
&gt; ++//      {{break}}<br>
&gt; ++// Break keyword is past.<br>
&gt; ++func (t *Tree) breakControl(pos Pos, line int) Node {<br>
&gt; ++         if token := t.next(); token.typ != itemRightDelim {<br>
&gt; ++                     t.unexpected(token, &quot;in {{break}}&quot;)<br>
&gt; ++         }<br>
&gt; ++         if t.rangeDepth == 0 {<br>
&gt; ++                     t.errorf(&quot;{{break}} outside {{range}}&quot;)<br>
&gt; ++         }<br>
&gt; ++         return t.newBreak(pos, line)<br>
&gt; ++}<br>
&gt; ++<br>
&gt; ++// Continue:<br>
&gt; ++//      {{continue}}<br>
&gt; ++// Continue keyword is past.<br>
&gt; ++func (t *Tree) continueControl(pos Pos, line int) Node {<br>
&gt; ++         if token := t.next(); token.typ != itemRightDelim {<br>
&gt; ++                     t.unexpected(token, &quot;in {{continue}}&quot;)<br>
&gt; ++         }<br>
&gt; ++         if t.rangeDepth == 0 {<br>
&gt; ++                     t.errorf(&quot;{{continue}} outside {{range}}&quot;)<br>
&gt; ++         }<br>
&gt; ++         return t.newContinue(pos, line)<br>
&gt; ++}<br>
&gt; ++<br>
&gt; + // Pipeline:<br>
&gt; + //      declarations? command (&#39;|&#39; command)*<br>
&gt; + func (t *Tree) pipeline(context string, end itemType) (pipe *PipeNode) {<br>
&gt; +@@ -479,8 +512,14 @@ func (t *Tree) checkPipeline(pipe *PipeNode, context \
string) {<br> &gt; + func (t *Tree) parseControl(allowElseIf bool, context string) \
(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) {<br> &gt; +           \
defer t.popVars(len(t.vars))<br> &gt; +           pipe = t.pipeline(context, \
itemRightDelim)<br> &gt; ++         if context == &quot;range&quot; {<br>
&gt; ++                     t.rangeDepth++<br>
&gt; ++         }<br>
&gt; +           var next Node<br>
&gt; +           list, next = t.itemList()<br>
&gt; ++         if context == &quot;range&quot; {<br>
&gt; ++                     t.rangeDepth--<br>
&gt; ++         }<br>
&gt; +           switch next.Type() {<br>
&gt; +           case nodeEnd: //done<br>
&gt; +           case nodeElse:<br>
&gt; +@@ -522,7 +561,8 @@ func (t *Tree) ifControl() Node {<br>
&gt; + //      {{range pipeline}} itemList {{else}} itemList {{end}}<br>
&gt; + // Range keyword is past.<br>
&gt; + func (t *Tree) rangeControl() Node {<br>
&gt; +-         return t.newRange(t.parseControl(false, &quot;range&quot;))<br>
&gt; ++         r := t.newRange(t.parseControl(false, &quot;range&quot;))<br>
&gt; ++         return r<br>
&gt; + }<br>
&gt; +<br>
&gt; + // With:<br>
&gt; +diff --git a/src/text/template/parse/parse_test.go \
b/src/text/template/parse/parse_test.go<br> &gt; +index 220f984..ba45636 100644<br>
&gt; +--- a/src/text/template/parse/parse_test.go<br>
&gt; ++++ b/src/text/template/parse/parse_test.go<br>
&gt; +@@ -230,6 +230,10 @@ var parseTests = []parseTest{<br>
&gt; +                       `{{range $x := .SI}}{{.}}{{end}}`},<br>
&gt; +           {&quot;range 2 vars&quot;, &quot;{{range $x, $y := \
.SI}}{{.}}{{end}}&quot;, noError,<br> &gt; +                       `{{range $x, $y := \
.SI}}{{.}}{{end}}`},<br> &gt; ++         {&quot;range with break&quot;, &quot;{{range \
.SI}}{{.}}{{break}}{{end}}&quot;, noError,<br> &gt; ++                     `{{range \
.SI}}{{.}}{{break}}{{end}}`},<br> &gt; ++         {&quot;range with continue&quot;, \
&quot;{{range .SI}}{{.}}{{continue}}{{end}}&quot;, noError,<br> &gt; ++               \
`{{range .SI}}{{.}}{{continue}}{{end}}`},<br> &gt; +           \
{&quot;constants&quot;, &quot;{{range .SI 1 -3.2i true false &#39;a&#39; \
nil}}{{end}}&quot;, noError,<br> &gt; +                       `{{range .SI 1 -3.2i \
true false &#39;a&#39; nil}}{{end}}`},<br> &gt; +           {&quot;template&quot;, \
&quot;{{template `x`}}&quot;, noError,<br> &gt; +@@ -279,6 +283,10 @@ var parseTests \
= []parseTest{<br> &gt; +           {&quot;adjacent args&quot;, &quot;{{printf \
3`x`}}&quot;, hasError, &quot;&quot;},<br> &gt; +           {&quot;adjacent args with \
.&quot;, &quot;{{printf `x`.}}&quot;, hasError, &quot;&quot;},<br> &gt; +           \
{&quot;extra end after if&quot;, &quot;{{if .X}}a{{else if .Y}}b{{end}}{{end}}&quot;, \
hasError, &quot;&quot;},<br> &gt; ++         {&quot;break outside range&quot;, \
&quot;{{range .}}{{end}} {{break}}&quot;, hasError, &quot;&quot;},<br> &gt; ++        \
{&quot;continue outside range&quot;, &quot;{{range .}}{{end}} {{continue}}&quot;, \
hasError, &quot;&quot;},<br> &gt; ++         {&quot;break in range else&quot;, \
&quot;{{range .}}{{else}}{{break}}{{end}}&quot;, hasError, &quot;&quot;},<br> &gt; ++ \
{&quot;continue in range else&quot;, &quot;{{range \
.}}{{else}}{{continue}}{{end}}&quot;, hasError, &quot;&quot;},<br> &gt; +           \
// Other kinds of assignments and operators aren&#39;t available yet.<br> &gt; +      \
{&quot;bug0a&quot;, &quot;{{$x := 0}}{{$x}}&quot;, noError, &quot;{{$x := \
0}}{{$x}}&quot;},<br> &gt; +           {&quot;bug0b&quot;, &quot;{{$x += \
1}}{{$x}}&quot;, hasError, &quot;&quot;},<br> &gt; +--<br>
&gt; +2.7.4<br>
&gt; diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-3.patch \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_6.patch<br> &gt; similarity index \
53%<br> &gt; rename from meta/recipes-devtools/go/go-1.14/CVE-2023-24538-3.patch<br>
&gt; rename to meta/recipes-devtools/go/go-1.14/CVE-2023-24538_6.patch<br>
&gt; index d5bb33e091..baf400b891 100644<br>
&gt; --- a/meta/recipes-devtools/go/go-1.14/CVE-2023-24538-3.patch<br>
&gt; +++ b/meta/recipes-devtools/go/go-1.14/CVE-2023-24538_6.patch<br>
&gt; @@ -1,7 +1,7 @@<br>
&gt;   From 16f4882984569f179d73967c9eee679bb9b098c5 Mon Sep 17 00:00:00 2001<br>
&gt;   From: Roland Shoemaker &lt;<a href="mailto:bracewell@google.com" \
target="_blank">bracewell@google.com</a>&gt;<br> &gt;   Date: Mon, 20 Mar 2023 \
11:01:13 -0700<br> &gt; -Subject: [PATCH 3/3] html/template: disallow actions in JS \
template literals<br> &gt; +Subject: [PATCH 6/6] html/template: disallow actions in \
JS template literals<br> &gt;<br>
&gt;   ECMAScript 6 introduced template literals[0][1] which are delimited with<br>
&gt;   backticks. These need to be escaped in a similar fashion to the<br>
&gt; @@ -52,12 +52,15 @@ CVE: CVE-2023-24538<br>
&gt;   Signed-off-by: Shubham Kulkarni &lt;<a href="mailto:skulkarni@mvista.com" \
target="_blank">skulkarni@mvista.com</a>&gt;<br> &gt;   ---<br>
&gt;     src/html/template/context.go         |   2 ++<br>
&gt; - src/html/template/error.go            | 13 +++++++++++++<br>
&gt; - src/html/template/escape.go           | 11 +++++++++++<br>
&gt; + src/html/template/error.go            | 13 ++++++++<br>
&gt; + src/html/template/escape.go           | 11 +++++++<br>
&gt; + src/html/template/escape_test.go   | 66 \
++++++++++++++++++++++-----------------<br> &gt;     src/html/template/js.go          \
|   2 ++<br> &gt; - src/html/template/jsctx_string.go |   9 +++++++++<br>
&gt; - src/html/template/transition.go     |   7 ++++++-<br>
&gt; - 6 files changed, 43 insertions(+), 1 deletion(-)<br>
&gt; + src/html/template/js_test.go         |   2 +-<br>
&gt; + src/html/template/jsctx_string.go |   9 ++++++<br>
&gt; + src/html/template/state_string.go | 37 ++++++++++++++++++++--<br>
&gt; + src/html/template/transition.go     |   7 ++++-<br>
&gt; + 9 files changed, 116 insertions(+), 33 deletions(-)<br>
&gt;<br>
&gt;   diff --git a/src/html/template/context.go b/src/html/template/context.go<br>
&gt;   index f7d4849..0b65313 100644<br>
&gt; @@ -125,6 +128,104 @@ index f12dafa..29ca5b3 100644<br>
&gt;              case stateJSRegexp:<br>
&gt;                          s = append(s, \
&quot;_html_template_jsregexpescaper&quot;)<br> &gt;              case stateCSS:<br>
&gt; +diff --git a/src/html/template/escape_test.go \
b/src/html/template/escape_test.go<br> &gt; +index fa2b84a..1b150e9 100644<br>
&gt; +--- a/src/html/template/escape_test.go<br>
&gt; ++++ b/src/html/template/escape_test.go<br>
&gt; +@@ -681,35 +681,31 @@ func TestEscape(t *testing.T) {<br>
&gt; +           }<br>
&gt; +<br>
&gt; +           for _, test := range tests {<br>
&gt; +-                     tmpl := New(<a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>)<br> &gt; +-                     tmpl = \
Must(tmpl.Parse(test.input))<br> &gt; +-                     // Check for bug 6459: \
Tree field was not set in Parse.<br> &gt; +-                     if tmpl.Tree != \
tmpl.text.Tree {<br> &gt; +-                                 t.Errorf(&quot;%s: tree \
not set properly&quot;, <a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>)<br> &gt; +-                                 \
continue<br> &gt; +-                     }<br>
&gt; +-                     b := new(bytes.Buffer)<br>
&gt; +-                     if err := tmpl.Execute(b, data); err != nil {<br>
&gt; +-                                 t.Errorf(&quot;%s: template execution failed: \
%s&quot;, <a href="http://test.name" rel="noreferrer" target="_blank">test.name</a>, \
err)<br> &gt; +-                                 continue<br>
&gt; +-                     }<br>
&gt; +-                     if w, g := test.output, b.String(); w != g {<br>
&gt; +-                                 t.Errorf(&quot;%s: escaped output: \
want\n\t%q\ngot\n\t%q&quot;, <a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>, w, g)<br> &gt; +-                                 \
continue<br> &gt; +-                     }<br>
&gt; +-                     b.Reset()<br>
&gt; +-                     if err := tmpl.Execute(b, pdata); err != nil {<br>
&gt; +-                                 t.Errorf(&quot;%s: template execution failed \
for pointer: %s&quot;, <a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>, err)<br> &gt; +-                                 \
continue<br> &gt; +-                     }<br>
&gt; +-                     if w, g := test.output, b.String(); w != g {<br>
&gt; +-                                 t.Errorf(&quot;%s: escaped output for \
pointer: want\n\t%q\ngot\n\t%q&quot;, <a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>, w, g)<br> &gt; +-                                 \
continue<br> &gt; +-                     }<br>
&gt; +-                     if tmpl.Tree != tmpl.text.Tree {<br>
&gt; +-                                 t.Errorf(&quot;%s: tree mismatch&quot;, <a \
href="http://test.name" rel="noreferrer" target="_blank">test.name</a>)<br> &gt; +-   \
continue<br> &gt; +-                     }<br>
&gt; ++                     t.Run(<a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>, func(t *testing.T) {<br> &gt; ++                       \
tmpl := New(<a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>)<br> &gt; ++                                 tmpl = \
Must(tmpl.Parse(test.input))<br> &gt; ++                                 // Check for \
bug 6459: Tree field was not set in Parse.<br> &gt; ++                                \
if tmpl.Tree != tmpl.text.Tree {<br> &gt; ++                                          \
t.Fatalf(&quot;%s: tree not set properly&quot;, <a href="http://test.name" \
rel="noreferrer" target="_blank">test.name</a>)<br> &gt; ++                           \
}<br> &gt; ++                                 b := new(strings.Builder)<br>
&gt; ++                                 if err := tmpl.Execute(b, data); err != nil \
{<br> &gt; ++                                             t.Fatalf(&quot;%s: template \
execution failed: %s&quot;, <a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>, err)<br> &gt; ++                                 }<br>
&gt; ++                                 if w, g := test.output, b.String(); w != g \
{<br> &gt; ++                                             t.Fatalf(&quot;%s: escaped \
output: want\n\t%q\ngot\n\t%q&quot;, <a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>, w, g)<br> &gt; ++                                 \
}<br> &gt; ++                                 b.Reset()<br>
&gt; ++                                 if err := tmpl.Execute(b, pdata); err != nil \
{<br> &gt; ++                                             t.Fatalf(&quot;%s: template \
execution failed for pointer: %s&quot;, <a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>, err)<br> &gt; ++                                 }<br>
&gt; ++                                 if w, g := test.output, b.String(); w != g \
{<br> &gt; ++                                             t.Fatalf(&quot;%s: escaped \
output for pointer: want\n\t%q\ngot\n\t%q&quot;, <a href="http://test.name" \
rel="noreferrer" target="_blank">test.name</a>, w, g)<br> &gt; ++                     \
}<br> &gt; ++                                 if tmpl.Tree != tmpl.text.Tree {<br>
&gt; ++                                             t.Fatalf(&quot;%s: tree \
mismatch&quot;, <a href="http://test.name" rel="noreferrer" \
target="_blank">test.name</a>)<br> &gt; ++                                 }<br>
&gt; ++                     })<br>
&gt; +           }<br>
&gt; + }<br>
&gt; +<br>
&gt; +@@ -936,6 +932,10 @@ func TestErrors(t *testing.T) {<br>
&gt; +                                   &quot;{{range .Items}}&lt;a{{if \
.X}}{{end}}&gt;{{if .X}}{{break}}{{end}}{{end}}&quot;,<br> &gt; +                     \
&quot;&quot;,<br> &gt; +                       },<br>
&gt; ++                     {<br>
&gt; ++                                 &quot;&lt;script&gt;var a = \
`${a+b}`&lt;/script&gt;`&quot;,<br> &gt; ++                                 \
&quot;&quot;,<br> &gt; ++                     },<br>
&gt; +                       // Error cases.<br>
&gt; +                       {<br>
&gt; +                                   &quot;{{if .Cond}}&lt;a{{end}}&quot;,<br>
&gt; +@@ -1082,6 +1082,10 @@ func TestErrors(t *testing.T) {<br>
&gt; +                                   // html is allowed since it is the last \
command in the pipeline, but urlquery is not.<br> &gt; +                              \
`predefined escaper &quot;urlquery&quot; disallowed in template`,<br> &gt; +          \
},<br> &gt; ++                     {<br>
&gt; ++                                 &quot;&lt;script&gt;var tmpl = `asd \
{{.}}`;&lt;/script&gt;&quot;,<br> &gt; ++                                 `{{.}} \
appears in a JS template literal`,<br> &gt; ++                     },<br>
&gt; +           }<br>
&gt; +           for _, test := range tests {<br>
&gt; +                       buf := new(bytes.Buffer)<br>
&gt; +@@ -1304,6 +1308,10 @@ func TestEscapeText(t *testing.T) {<br>
&gt; +                                   context{state: stateJSSqStr, delim: \
delimDoubleQuote, attr: attrScript},<br> &gt; +                       },<br>
&gt; +                       {<br>
&gt; ++                                 &quot;&lt;a onclick=\&quot;`foo&quot;,<br>
&gt; ++                                 context{state: stateJSBqStr, delim: \
delimDoubleQuote, attr: attrScript},<br> &gt; ++                     },<br>
&gt; ++                     {<br>
&gt; +                                   `&lt;A ONCLICK=&quot;&#39;`,<br>
&gt; +                                   context{state: stateJSSqStr, delim: \
delimDoubleQuote, attr: attrScript},<br> &gt; +                       },<br>
&gt;   diff --git a/src/html/template/js.go b/src/html/template/js.go<br>
&gt;   index ea9c183..b888eaf 100644<br>
&gt;   --- a/src/html/template/js.go<br>
&gt; @@ -145,6 +246,19 @@ index ea9c183..b888eaf 100644<br>
&gt;              &#39;+&#39;:   `\u002b`,<br>
&gt;              &#39;/&#39;:   `\/`,<br>
&gt;              &#39;&lt;&#39;:   `\u003c`,<br>
&gt; +diff --git a/src/html/template/js_test.go b/src/html/template/js_test.go<br>
&gt; +index d7ee47b..7d963ae 100644<br>
&gt; +--- a/src/html/template/js_test.go<br>
&gt; ++++ b/src/html/template/js_test.go<br>
&gt; +@@ -292,7 +292,7 @@ func TestEscapersOnLower7AndSelectHighCodepoints(t \
*testing.T) {<br> &gt; +                                               \
`0123456789:;\u003c=\u003e?` +<br> &gt; +                                             \
`@ABCDEFGHIJKLMNO` +<br> &gt; +                                               \
`PQRSTUVWXYZ[\\]^_` +<br> &gt; +-                                             \
&quot;`abcdefghijklmno&quot; +<br> &gt; ++                                            \
&quot;\\u0060abcdefghijklmno&quot; +<br> &gt; +                                       \
&quot;pqrstuvwxyz{|}~\u007f&quot; +<br> &gt; +                                        \
&quot;\u00A0\u0100\\u2028\\u2029\ufeff\U0001D11E&quot;,<br> &gt; +                    \
},<br> &gt;   diff --git a/src/html/template/jsctx_string.go \
b/src/html/template/jsctx_string.go<br> &gt;   index dd1d87e..2394893 100644<br>
&gt;   --- a/src/html/template/jsctx_string.go<br>
&gt; @@ -165,6 +279,55 @@ index dd1d87e..2394893 100644<br>
&gt;     const _jsCtx_name = &quot;jsCtxRegexpjsCtxDivOpjsCtxUnknown&quot;<br>
&gt;<br>
&gt;     var _jsCtx_index = [...]uint8{0, 11, 21, 33}<br>
&gt; +diff --git a/src/html/template/state_string.go \
b/src/html/template/state_string.go<br> &gt; +index 05104be..6fb1a6e 100644<br>
&gt; +--- a/src/html/template/state_string.go<br>
&gt; ++++ b/src/html/template/state_string.go<br>
&gt; +@@ -4,9 +4,42 @@ package template<br>
&gt; +<br>
&gt; + import &quot;strconv&quot;<br>
&gt; +<br>
&gt; +-const _state_name = \
&quot;stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCD \
ATAstateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSRegexpstateJSBloc \
kCmtstateJSLineCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateError&quot;<br>
 &gt; ++func _() {<br>
&gt; ++         // An &quot;invalid array index&quot; compiler error signifies that \
the constant values have changed.<br> &gt; ++         // Re-run the stringer command \
to generate them again.<br> &gt; ++         var x [1]struct{}<br>
&gt; ++         _ = x[stateText-0]<br>
&gt; ++         _ = x[stateTag-1]<br>
&gt; ++         _ = x[stateAttrName-2]<br>
&gt; ++         _ = x[stateAfterName-3]<br>
&gt; ++         _ = x[stateBeforeValue-4]<br>
&gt; ++         _ = x[stateHTMLCmt-5]<br>
&gt; ++         _ = x[stateRCDATA-6]<br>
&gt; ++         _ = x[stateAttr-7]<br>
&gt; ++         _ = x[stateURL-8]<br>
&gt; ++         _ = x[stateSrcset-9]<br>
&gt; ++         _ = x[stateJS-10]<br>
&gt; ++         _ = x[stateJSDqStr-11]<br>
&gt; ++         _ = x[stateJSSqStr-12]<br>
&gt; ++         _ = x[stateJSBqStr-13]<br>
&gt; ++         _ = x[stateJSRegexp-14]<br>
&gt; ++         _ = x[stateJSBlockCmt-15]<br>
&gt; ++         _ = x[stateJSLineCmt-16]<br>
&gt; ++         _ = x[stateCSS-17]<br>
&gt; ++         _ = x[stateCSSDqStr-18]<br>
&gt; ++         _ = x[stateCSSSqStr-19]<br>
&gt; ++         _ = x[stateCSSDqURL-20]<br>
&gt; ++         _ = x[stateCSSSqURL-21]<br>
&gt; ++         _ = x[stateCSSURL-22]<br>
&gt; ++         _ = x[stateCSSBlockCmt-23]<br>
&gt; ++         _ = x[stateCSSLineCmt-24]<br>
&gt; ++         _ = x[stateError-25]<br>
&gt; ++         _ = x[stateDead-26]<br>
&gt; ++}<br>
&gt; ++<br>
&gt; ++const _state_name = \
&quot;stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCD \
ATAstateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSBqStrstateJSRegex \
pstateJSBlockCmtstateJSLineCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateErrorstateDead&quot;<br>
 &gt; +<br>
&gt; +-var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100, 111, \
118, 130, 142, 155, 170, 184, 192, 205, 218, 231, 244, 255, 271, 286, 296}<br> &gt; \
++var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100, 111, 118, \
130, 142, 154, 167, 182, 196, 204, 217, 230, 243, 256, 267, 283, 298, 308, 317}<br> \
&gt; +<br> &gt; + func (i state) String() string {<br>
&gt; +           if i &gt;= state(len(_state_index)-1) {<br>
&gt;   diff --git a/src/html/template/transition.go \
b/src/html/template/transition.go<br> &gt;   index 06df679..92eb351 100644<br>
&gt;   --- a/src/html/template/transition.go<br>
&gt; diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2023-39318.patch \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-39318.patch<br> &gt; index \
20e70c0485..00def8fcda 100644<br> &gt; --- \
a/meta/recipes-devtools/go/go-1.14/CVE-2023-39318.patch<br> &gt; +++ \
b/meta/recipes-devtools/go/go-1.14/CVE-2023-39318.patch<br> &gt; @@ -34,9 +34,9 @@ \
Signed-off-by: Siddharth Doshi &lt;<a href="mailto:sdoshi@mvista.com" \
target="_blank">sdoshi@mvista.com</a>&gt;<br> &gt;     src/html/template/context.go   \
|   6 ++-<br> &gt;     src/html/template/escape.go           |   5 +-<br>
&gt;     src/html/template/escape_test.go   | 10 ++++<br>
&gt; - src/html/template/state_string.go |   4 +-<br>
&gt; + src/html/template/state_string.go | 26 +++++-----<br>
&gt;     src/html/template/transition.go     | 80 ++++++++++++++++++++-----------<br>
&gt; - 5 files changed, 72 insertions(+), 33 deletions(-)<br>
&gt; + 5 files changed, 84 insertions(+), 43 deletions(-)<br>
&gt;<br>
&gt;   diff --git a/src/html/template/context.go b/src/html/template/context.go<br>
&gt;   index 0b65313..4eb7891 100644<br>
&gt; @@ -105,14 +105,38 @@ diff --git a/src/html/template/state_string.go \
b/src/html/template/state_string.<br> &gt;   index 05104be..b5cfe70 100644<br>
&gt;   --- a/src/html/template/state_string.go<br>
&gt;   +++ b/src/html/template/state_string.go<br>
&gt; -@@ -4,9 +4,9 @@ package template<br>
&gt; -<br>
&gt; - import &quot;strconv&quot;<br>
&gt; +@@ -25,21 +25,23 @@ func _() {<br>
&gt; +           _ = x[stateJSRegexp-14]<br>
&gt; +           _ = x[stateJSBlockCmt-15]<br>
&gt; +           _ = x[stateJSLineCmt-16]<br>
&gt; +-         _ = x[stateCSS-17]<br>
&gt; +-         _ = x[stateCSSDqStr-18]<br>
&gt; +-         _ = x[stateCSSSqStr-19]<br>
&gt; +-         _ = x[stateCSSDqURL-20]<br>
&gt; +-         _ = x[stateCSSSqURL-21]<br>
&gt; +-         _ = x[stateCSSURL-22]<br>
&gt; +-         _ = x[stateCSSBlockCmt-23]<br>
&gt; +-         _ = x[stateCSSLineCmt-24]<br>
&gt; +-         _ = x[stateError-25]<br>
&gt; +-         _ = x[stateDead-26]<br>
&gt; ++         _ = x[stateJSHTMLOpenCmt-17]<br>
&gt; ++         _ = x[stateJSHTMLCloseCmt-18]<br>
&gt; ++         _ = x[stateCSS-19]<br>
&gt; ++         _ = x[stateCSSDqStr-20]<br>
&gt; ++         _ = x[stateCSSSqStr-21]<br>
&gt; ++         _ = x[stateCSSDqURL-22]<br>
&gt; ++         _ = x[stateCSSSqURL-23]<br>
&gt; ++         _ = x[stateCSSURL-24]<br>
&gt; ++         _ = x[stateCSSBlockCmt-25]<br>
&gt; ++         _ = x[stateCSSLineCmt-26]<br>
&gt; ++         _ = x[stateError-27]<br>
&gt; ++         _ = x[stateDead-28]<br>
&gt; + }<br>
&gt;<br>
&gt; --const _state_name = \
&quot;stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCD \
ATAstateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSRegexpstateJSBloc \
kCmtstateJSLineCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateError&quot;<br>
 &gt; +-const _state_name = \
&quot;stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCD \
ATAstateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSBqStrstateJSRegex \
pstateJSBlockCmtstateJSLineCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateErrorstateDead&quot;<br>
 &gt;   +const _state_name = \
&quot;stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCD \
ATAstateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSBqStrstateJSRegex \
pstateJSBlockCmtstateJSLineCmtstateJSHTMLOpenCmtstateJSHTMLCloseCmtstateCSSstateCSSDqS \
trstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateErrorstateDead&quot;<br>
 &gt;<br>
&gt; --var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100, 111, \
118, 130, 142, 155, 170, 184, 192, 205, 218, 231, 244, 255, 271, 286, 296}<br> &gt; \
+-var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100, 111, 118, \
130, 142, 154, 167, 182, 196, 204, 217, 230, 243, 256, 267, 283, 298, 308, 317}<br> \
&gt;   +var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100, 111, \
118, 130, 142, 154, 167, 182, 196, 214, 233, 241, 254, 267, 280, 293, 304, 320, 335, \
345, 354}<br> &gt;<br>
&gt;     func (i state) String() string {<br>
&gt; --<br>
&gt; 2.42.0<br>
&gt;<br>
&gt;<br>
&gt; <br>
&gt;<br>
</blockquote></div>



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#188460): https://lists.openembedded.org/g/openembedded-core/message/188460
Mute This Topic: https://lists.openembedded.org/mt/101664679/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic