diff --git a/0001-CVE2024-24785-html-template-escape-additional-tokens-in-MarshalJSON-errors.patch b/0001-CVE2024-24785-html-template-escape-additional-tokens-in-MarshalJSON-errors.patch
new file mode 100644
index 0000000000000000000000000000000000000000..26c6ea6f8ddade53156760d3457d7a3522b4dbf7
--- /dev/null
+++ b/0001-CVE2024-24785-html-template-escape-additional-tokens-in-MarshalJSON-errors.patch
@@ -0,0 +1,191 @@
+From 05f6996b6907f94835fb826864bcdf81aa257483 Mon Sep 17 00:00:00 2001
+From: Damien Neil
+Date: Wed, 28 Feb 2024 19:53:41 +0000
+Subject: [PATCH] html/template: escape additional tokens in MarshalJSON errors
+
+…rshalJSON errors
+
+Escape "
+Reviewed-by: Damien Neil
+(cherry picked from commit ccbc725)
+Reviewed-on: https://go-review.googlesource.com/c/go/+/567515
+Reviewed-by: Carlos Amedee
+---
+ src/html/template/js.go | 21 +++++++-
+ src/html/template/js_test.go | 92 ++++++++++++++++++++----------------
+ 2 files changed, 71 insertions(+), 42 deletions(-)
+
+diff --git a/src/html/template/js.go b/src/html/template/js.go
+index 4e05c14..36e828b 100644
+--- a/src/html/template/js.go
++++ b/src/html/template/js.go
+@@ -171,13 +171,32 @@ func jsValEscaper(args ...any) string {
+ // cyclic data. This may be an unacceptable DoS risk.
+ b, err := json.Marshal(a)
+ if err != nil {
+- // Put a space before comment so that if it is flush against
++ // While the standard JSON marshaller does not include user controlled
++ // information in the error message, if a type has a MarshalJSON method,
++ // the content of the error message is not guaranteed. Since we insert
++ // the error into the template, as part of a comment, we attempt to
++ // prevent the error from either terminating the comment, or the script
++ // block itself.
++ //
++ // In particular we:
++ // * replace "*/" comment end tokens with "* /", which does not
++ // terminate the comment
++ // * replace " 1 so this loses precision in JS
+ // but it is still a representable integer literal.
+- {uint64(1)<<53 + 1, " 9007199254740993 "},
+- {float32(1.0), " 1 "},
+- {float32(-1.0), " -1 "},
+- {float32(0.5), " 0.5 "},
+- {float32(-0.5), " -0.5 "},
+- {float32(1.0) / float32(256), " 0.00390625 "},
+- {float32(0), " 0 "},
+- {math.Copysign(0, -1), " -0 "},
+- {float64(1.0), " 1 "},
+- {float64(-1.0), " -1 "},
+- {float64(0.5), " 0.5 "},
+- {float64(-0.5), " -0.5 "},
+- {float64(0), " 0 "},
+- {math.Copysign(0, -1), " -0 "},
+- {"", `""`},
+- {"foo", `"foo"`},
++ {uint64(1)<<53 + 1, " 9007199254740993 ", false},
++ {float32(1.0), " 1 ", false},
++ {float32(-1.0), " -1 ", false},
++ {float32(0.5), " 0.5 ", false},
++ {float32(-0.5), " -0.5 ", false},
++ {float32(1.0) / float32(256), " 0.00390625 ", false},
++ {float32(0), " 0 ", false},
++ {math.Copysign(0, -1), " -0 ", false},
++ {float64(1.0), " 1 ", false},
++ {float64(-1.0), " -1 ", false},
++ {float64(0.5), " 0.5 ", false},
++ {float64(-0.5), " -0.5 ", false},
++ {float64(0), " 0 ", false},
++ {math.Copysign(0, -1), " -0 ", false},
++ {"", `""`, false},
++ {"foo", `"foo"`, false},
+ // Newlines.
+- {"\r\n\u2028\u2029", `"\r\n\u2028\u2029"`},
+- // "\v" == "v" on IE 6 so use "\u000b" instead.
+- {"\t\x0b", `"\t\u000b"`},
+- {struct{ X, Y int }{1, 2}, `{"X":1,"Y":2}`},
+- {[]any{}, "[]"},
+- {[]any{42, "foo", nil}, `[42,"foo",null]`},
+- {[]string{""}, `["\u003c!--","\u003c/script\u003e","--\u003e"]`},
+- {"", `"--\u003e"`},
+- {"", `"]]\u003e"`},
+- {"", "-->"}, `["\u003c!--","\u003c/script\u003e","--\u003e"]`, false},
++ {"", `"--\u003e"`, false},
++ {"", `"]]\u003e"`, false},
++ {"= 5
%else
@@ -354,6 +354,9 @@ fi
%files devel -f go-tests.list -f go-misc.list -f go-src.list
%changelog
+* Thu Mar 7 2024 woody2918 - 1.21.4-3
+- Fix CVE2024-24785
+
* Wed Dec 13 2023 jiahua.yu - 1.21.4-2
- init support for arch ppc64le