]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.25] cmd/go: remove user-content from doc strings in cgo ASTs.
authorNeal Patel <nealpatel@google.com>
Tue, 6 Jan 2026 21:09:19 +0000 (16:09 -0500)
committerGopher Robot <gobot@golang.org>
Wed, 28 Jan 2026 20:31:52 +0000 (12:31 -0800)
Thank you to RyotaK (https://ryotak.net) of GMO Flatt Security Inc. for reporting this issue.

Updates #76697
Fixes #77129
Fixes CVE-2025-61732

Change-Id: I9ecbef556f6e545fb152407041cd086c069f22d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/740040
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
src/cmd/cgo/ast.go

index 861479db7acf5bf499baaccf0f061d056f17ec1b..11f5831ccdfeaef984f8ad19607140b257345439 100644 (file)
@@ -301,17 +301,12 @@ func (f *File) saveExport(x interface{}, context astContext) {
                        error_(c.Pos(), "export comment has wrong name %q, want %q", name, n.Name.Name)
                }
 
-               doc := ""
-               for _, c1 := range n.Doc.List {
-                       if c1 != c {
-                               doc += c1.Text + "\n"
-                       }
-               }
-
                f.ExpFunc = append(f.ExpFunc, &ExpFunc{
                        Func:    n,
                        ExpName: name,
-                       Doc:     doc,
+                       // Caution: Do not set the Doc field on purpose
+                       // to ensure that there are no unintended artifacts
+                       // in the binary. See https://go.dev/issue/76697.
                })
                break
        }