Commit 3fabb12ed4 for golang

commit 3fabb12ed4319bf21867d5ad5ff0032b9f21c8b1
Author: Dmitri Shuralyov <dmitshur@golang.org>
Date:   Thu Nov 26 13:28:11 2026 -0500

    cmd/pprof: update vendored github.com/google/pprof

    Pull in the latest published version of github.com/google/pprof
    as part of the continuous process of keeping Go's dependencies
    up to date.

    For #36905.

    [git-generate]
    cd src/cmd
    go get github.com/google/pprof@v0.0.0-20261118010117-084b33a85f63
    go mod tidy
    go mod vendor

    Change-Id: Ib588c985b3e8b58ca797c0b87f4c00216a459de6
    Reviewed-on: https://go-review.googlesource.com/c/go/+/866896
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
    Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
    LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

diff --git a/src/cmd/go.mod b/src/cmd/go.mod
index 866576c6bd..bb44560cb6 100644
--- a/src/cmd/go.mod
+++ b/src/cmd/go.mod
@@ -3,7 +3,7 @@ module cmd
 go 1.28

 require (
-	github.com/google/pprof v0.0.0-20260507013755-92041b743c96
+	github.com/google/pprof v0.0.0-20261118010117-084b33a85f63
 	golang.org/x/arch v0.33.1-0.20261125042448-08f54687881f
 	golang.org/x/build v0.0.0-20261119205413-41b438ee44b1
 	golang.org/x/mod v0.43.1-0.20261112161916-2b553c8b61bf
diff --git a/src/cmd/go.sum b/src/cmd/go.sum
index c3335cc3fc..825e361bce 100644
--- a/src/cmd/go.sum
+++ b/src/cmd/go.sum
@@ -1,7 +1,7 @@
 github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
 github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
-github.com/google/pprof v0.0.0-20260507013755-92041b743c96 h1:YDDnaZ9afWajDboPMt9Vikqca/yWAX7KAxVzb4lJU1M=
-github.com/google/pprof v0.0.0-20260507013755-92041b743c96/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI=
+github.com/google/pprof v0.0.0-20261118010117-084b33a85f63 h1:dTH7+vX2yD0Xq3wXeU6R1s5uUuJC8o9sDW8g2k4bAg4=
+github.com/google/pprof v0.0.0-20261118010117-084b33a85f63/go.mod h1:yUo1AMMpsPIDFGuwDK8nLcf8+vvAd5l2O6JDZ6hpwrM=
 github.com/ianlancetaylor/demangle v0.0.0-20250417193237-f615e6bd150b h1:ogbOPx86mIhFy764gGkqnkFC8m5PJA7sPzlk9ppLVQA=
 github.com/ianlancetaylor/demangle v0.0.0-20250417193237-f615e6bd150b/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
 github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68=
diff --git a/src/cmd/vendor/github.com/google/pprof/driver/driver.go b/src/cmd/vendor/github.com/google/pprof/driver/driver.go
index 657a673521..ae37b18629 100644
--- a/src/cmd/vendor/github.com/google/pprof/driver/driver.go
+++ b/src/cmd/vendor/github.com/google/pprof/driver/driver.go
@@ -143,8 +143,8 @@ type ObjTool interface {
 	// corresponding to the start address.
 	Open(file string, start, limit, offset uint64, relocationSymbol string) (ObjFile, error)

-	// Disasm disassembles the named object file, starting at
-	// the start address and stopping at (before) the end address.
+	// Disasm disassembles the named object file in the address range
+	// [start, end), including start and excluding end.
 	Disasm(file string, start, end uint64, intelSyntax bool) ([]Inst, error)
 }

@@ -178,7 +178,7 @@ type ObjFile interface {
 	// If r is not nil, Symbols restricts the list to symbols
 	// with names matching the regular expression.
 	// If addr is not zero, Symbols restricts the list to symbols
-	// containing that address.
+	// containing that address in the inclusive range [Sym.Start, Sym.End].
 	Symbols(r *regexp.Regexp, addr uint64) ([]*Sym, error)

 	// Close closes the file, releasing associated resources.
@@ -194,7 +194,8 @@ type Frame struct {
 	StartLine int    // start line of function (if available)
 }

-// A Sym describes a single symbol in an object file.
+// A Sym describes a single symbol in an object file. Its address range
+// [Start, End] includes both endpoints.
 type Sym struct {
 	Name  []string // names of symbol (many if symbol was dedup'ed)
 	File  string   // object file containing symbol
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go b/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
index c2e45c6a83..0095d28f6a 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
@@ -147,7 +147,10 @@ func (d *addr2Liner) readFrame() (plugin.Frame, bool) {
 		funcname = ""
 	}

-	if fileline == "??:0" {
+	// GNU addr2line prints "??:?" for an unknown file and line since binutils
+	// 2.23 (2012), and "??:0" before it. LLVM's llvm-addr2line, which can be
+	// installed as addr2line, still prints "??:0".
+	if fileline == "??:0" || fileline == "??:?" {
 		fileline = ""
 	} else {
 		if i := strings.LastIndex(fileline, ":"); i >= 0 {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go b/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
index ed87b7e6f8..912f5e0940 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
@@ -131,16 +131,33 @@ func (bu *Binutils) SetTools(config string) {
 	bu.update(func(r *binrep) { initTools(r, config) })
 }

-func initTools(b *binrep, config string) {
-	// paths collect paths per tool; Key "" contains the default.
+// isToolName reports whether name is one of the tool names initTools looks up.
+// An entry is only read as a "<name>:<path>" pair for these names, so that a
+// path holding a colon, such as `C:\tools` on Windows, stays a path.
+func isToolName(name string) bool {
+	switch name {
+	case "llvm-symbolizer", "addr2line", "nm", "objdump":
+		return true
+	}
+	return false
+}
+
+// toolPaths splits the tools option into paths per tool. Key "" holds the
+// paths to search for every tool.
+func toolPaths(config string) map[string][]string {
 	paths := make(map[string][]string)
 	for _, t := range strings.Split(config, ",") {
 		name, path := "", t
-		if ct := strings.SplitN(t, ":", 2); len(ct) == 2 {
+		if ct := strings.SplitN(t, ":", 2); len(ct) == 2 && isToolName(ct[0]) {
 			name, path = ct[0], ct[1]
 		}
 		paths[name] = append(paths[name], path)
 	}
+	return paths
+}
+
+func initTools(b *binrep, config string) {
+	paths := toolPaths(config)

 	defaultPath := paths[""]
 	b.llvmSymbolizer, b.llvmSymbolizerFound = chooseExe([]string{"llvm-symbolizer"}, []string{}, append(paths["llvm-symbolizer"], defaultPath...))
@@ -254,8 +271,8 @@ func findExe(cmd string, paths []string) (string, bool) {
 	return cmd, false
 }

-// Disasm returns the assembly instructions for the specified address range
-// of a binary.
+// Disasm returns the assembly instructions in the address range [start, end)
+// of a binary, including start and excluding end.
 func (bu *Binutils) Disasm(file string, start, end uint64, intelSyntax bool) ([]plugin.Inst, error) {
 	b := bu.get()
 	if !b.objdumpFound {
@@ -586,6 +603,21 @@ type file struct {
 	m *elfMapping
 }

+// initBase initializes the relocation base for the file using the given address.
+// If the address is outside the file's mapping range, an error is returned without
+// computing or latching the base so that future calls with addresses within the
+// mapping range can succeed.
+func (f *file) initBase(addr uint64) error {
+	if f == nil {
+		return nil
+	}
+	if f.m != nil && f.m.start < f.m.limit && (addr < f.m.start || addr >= f.m.limit) {
+		return fmt.Errorf("specified address %x is outside the mapping range [%x, %x] for file %q", addr, f.m.start, f.m.limit, f.name)
+	}
+	f.baseOnce.Do(func() { f.baseErr = f.computeBase(addr) })
+	return f.baseErr
+}
+
 // computeBase computes the relocation base for the given binary file only if
 // the elfMapping field is set. It populates the base and isData fields and
 // returns an error.
@@ -593,7 +625,7 @@ func (f *file) computeBase(addr uint64) error {
 	if f == nil || f.m == nil {
 		return nil
 	}
-	if addr < f.m.start || addr >= f.m.limit {
+	if f.m.start < f.m.limit && (addr < f.m.start || addr >= f.m.limit) {
 		return fmt.Errorf("specified address %x is outside the mapping range [%x, %x] for file %q", addr, f.m.start, f.m.limit, f.name)
 	}
 	ef, err := elfOpen(f.name)
@@ -621,9 +653,8 @@ func (f *file) Name() string {
 }

 func (f *file) ObjAddr(addr uint64) (uint64, error) {
-	f.baseOnce.Do(func() { f.baseErr = f.computeBase(addr) })
-	if f.baseErr != nil {
-		return 0, f.baseErr
+	if err := f.initBase(addr); err != nil {
+		return 0, err
 	}
 	return addr - f.base, nil
 }
@@ -633,9 +664,8 @@ func (f *file) BuildID() string {
 }

 func (f *file) SourceLine(addr uint64) ([]plugin.Frame, error) {
-	f.baseOnce.Do(func() { f.baseErr = f.computeBase(addr) })
-	if f.baseErr != nil {
-		return nil, f.baseErr
+	if err := f.initBase(addr); err != nil {
+		return nil, err
 	}
 	return nil, nil
 }
@@ -664,9 +694,8 @@ type fileNM struct {
 }

 func (f *fileNM) SourceLine(addr uint64) ([]plugin.Frame, error) {
-	f.baseOnce.Do(func() { f.baseErr = f.computeBase(addr) })
-	if f.baseErr != nil {
-		return nil, f.baseErr
+	if err := f.initBase(addr); err != nil {
+		return nil, err
 	}
 	if f.addr2linernm == nil {
 		addr2liner, err := newAddr2LinerNM(f.b.nm, f.name, f.base)
@@ -691,9 +720,8 @@ type fileAddr2Line struct {
 }

 func (f *fileAddr2Line) SourceLine(addr uint64) ([]plugin.Frame, error) {
-	f.baseOnce.Do(func() { f.baseErr = f.computeBase(addr) })
-	if f.baseErr != nil {
-		return nil, f.baseErr
+	if err := f.initBase(addr); err != nil {
+		return nil, err
 	}
 	f.once.Do(f.init)
 	if f.llvmSymbolizer != nil {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/dotwriter/dotwriter.go b/src/cmd/vendor/github.com/google/pprof/internal/dotwriter/dotwriter.go
new file mode 100644
index 0000000000..3b206057d8
--- /dev/null
+++ b/src/cmd/vendor/github.com/google/pprof/internal/dotwriter/dotwriter.go
@@ -0,0 +1,197 @@
+// Copyright 2026 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package dotwriter emits Graphviz DOT digraphs with automatic escaping of
+// attribute values and identifiers so callers cannot inject raw DOT syntax.
+package dotwriter
+
+import (
+	"fmt"
+	"io"
+	"strconv"
+	"strings"
+)
+
+// Text holds a string whose contents are already escaped for inclusion inside
+// a double-quoted DOT string literal (and may contain intentional DOT escape
+// sequences such as \n or \l). Because raw is unexported, callers outside this
+// package cannot convert an unescaped string to Text directly.
+type Text struct {
+	raw string
+}
+
+// String returns the DOT-escaped representation (including any \n or \l
+// sequences) without surrounding quotes.
+func (t Text) String() string { return t.raw }
+
+// Escaped escapes s for DOT and wraps it as a single-segment Text.
+func Escaped(s string) Text {
+	return Text{escape(s)}
+}
+
+// LinesCenter escapes each line and joins them with Graphviz centered line
+// breaks (\n).
+func LinesCenter(lines []string) Text {
+	return Text{strings.Join(escapeAll(lines), `\n`)}
+}
+
+// LinesLeft escapes each line and terminates every line with a Graphviz
+// left-justified line break (\l).
+func LinesLeft(lines []string) Text {
+	if len(lines) == 0 {
+		return Text{}
+	}
+	return Text{strings.Join(escapeAll(lines), `\l`) + `\l`}
+}
+
+// Join concatenates multiple already-escaped Text values without inserting
+// line breaks.
+func Join(parts ...Text) Text {
+	var b strings.Builder
+	for _, p := range parts {
+		b.WriteString(p.raw)
+	}
+	return Text{b.String()}
+}
+
+// JoinLinesCenter joins non-empty Text values with centered line breaks (\n).
+func JoinLinesCenter(lines ...Text) Text {
+	var b strings.Builder
+	for i, l := range lines {
+		if i > 0 {
+			b.WriteString(`\n`)
+		}
+		b.WriteString(l.raw)
+	}
+	return Text{b.String()}
+}
+
+// ID is a DOT identifier (emitted bare if it matches [A-Za-z_][A-Za-z0-9_]*,
+// otherwise double-quoted and escaped).
+type ID string
+
+// Attr is a single key=value attribute on a DOT node, edge, or graph statement.
+// Supported val types are string (auto-escaped and quoted), Text (quoted
+// without re-escaping), ID (bare if safe, otherwise quoted and escaped), and
+// int.
+type Attr struct {
+	Key string
+	Val any
+}
+
+// Writer writes a single DOT digraph to an underlying io.Writer without
+// exposing raw write methods to callers.
+type Writer struct {
+	out io.Writer
+}
+
+// Begin starts a DOT digraph with the given name and returns a Writer for
+// emitting statements inside it. Call End to close the digraph.
+func Begin(out io.Writer, name string) *Writer {
+	w := &Writer{out: out}
+	fmt.Fprintf(w.out, "digraph %s {\n", quote(name))
+	return w
+}
+
+// End writes the closing brace of the digraph.
+func (w *Writer) End() {
+	fmt.Fprintln(w.out, "}")
+}
+
+// Legend emits the `subgraph cluster_L` legend box used by pprof callgraphs.
+func (w *Writer) Legend(title string, attrs ...Attr) {
+	fmt.Fprintf(w.out, "subgraph cluster_L { %s %s }\n", quote(title), formatAttrs(attrs))
+}
+
+// Node emits a node (or default attribute, e.g. `node [...]`) statement.
+func (w *Writer) Node(id ID, attrs ...Attr) {
+	fmt.Fprintf(w.out, "%s %s\n", formatID(id), formatAttrs(attrs))
+}
+
+// Edge emits a directed edge statement (`from -> to [...]`).
+func (w *Writer) Edge(from, to ID, attrs ...Attr) {
+	fmt.Fprintf(w.out, "%s -> %s %s\n", formatID(from), formatID(to), formatAttrs(attrs))
+}
+
+func formatID(id ID) string {
+	s := string(id)
+	if isBareID(s) {
+		return s
+	}
+	return quote(s)
+}
+
+func formatAttrs(attrs []Attr) string {
+	var b strings.Builder
+	b.WriteByte('[')
+	for i, a := range attrs {
+		if i > 0 {
+			b.WriteByte(' ')
+		}
+		if !isBareID(a.Key) {
+			panic(fmt.Sprintf("invalid DOT attribute key %q", a.Key))
+		}
+		b.WriteString(a.Key)
+		b.WriteByte('=')
+		switch v := a.Val.(type) {
+		case string:
+			b.WriteString(quote(v))
+		case Text:
+			b.WriteByte('"')
+			b.WriteString(v.raw)
+			b.WriteByte('"')
+		case ID:
+			b.WriteString(formatID(v))
+		case int:
+			b.WriteString(strconv.Itoa(v))
+		default:
+			panic(fmt.Sprintf("unsupported DOT attr type %T", v))
+		}
+	}
+	b.WriteByte(']')
+	return b.String()
+}
+
+func isBareID(s string) bool {
+	if s == "" || (s[0] >= '0' && s[0] <= '9') {
+		return false
+	}
+	for i := 0; i < len(s); i++ {
+		switch c := s[i]; {
+		case c >= 'a' && c <= 'z', c >= 'A' && c <= 'Z', c >= '0' && c <= '9', c == '_':
+		default:
+			return false
+		}
+	}
+	return true
+}
+
+func quote(s string) string {
+	return `"` + escape(s) + `"`
+}
+
+func escapeAll(in []string) []string {
+	out := make([]string, len(in))
+	for i, s := range in {
+		out[i] = escape(s)
+	}
+	return out
+}
+
+// escape escapes double quotes and backslashes, and replaces Graphviz's
+// "center" character (\n) with a left-justified character (\l).
+// See https://graphviz.org/docs/attr-types/escString/ for more info.
+func escape(str string) string {
+	return strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(str, `\`, `\\`), `"`, `\"`), "\n", `\l`)
+}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go
index f990780d75..00674be6a6 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go
@@ -339,15 +339,23 @@ func listHelp(c string, redirect bool) string {

 // browsers returns a list of commands to attempt for web visualization.
 func browsers() []string {
+	return browsersForOS(runtime.GOOS)
+}
+
+// browsersForOS returns the commands to attempt for web visualization on goos.
+func browsersForOS(goos string) []string {
 	var cmds []string
 	if userBrowser := os.Getenv("BROWSER"); userBrowser != "" {
 		cmds = append(cmds, userBrowser)
 	}
-	switch runtime.GOOS {
+	switch goos {
 	case "darwin":
 		cmds = append(cmds, "/usr/bin/open")
 	case "windows":
-		cmds = append(cmds, "cmd /c start")
+		// Trailing space causes strings.Split(v, " ") to produce an empty argument
+		// (""), which start takes as the window title. Without it start consumes a
+		// path or URL containing a space as the title and never opens it.
+		cmds = append(cmds, "cmd /c start ")
 	default:
 		// Commands opening browsers are prioritized over xdg-open, so browser()
 		// command can be used on linux to open the .svg file generated by the -web
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
index 99e6ba458a..6d182b7d13 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
@@ -288,11 +288,6 @@ func reportOptions(p *profile.Profile, numLabelUnits map[string]string, cfg conf
 		return nil, err
 	}

-	stype := sample.Type
-	if mean {
-		stype = "mean_" + stype
-	}
-
 	if cfg.DivideBy == 0 {
 		return nil, fmt.Errorf("zero divisor specified")
 	}
@@ -330,7 +325,7 @@ func reportOptions(p *profile.Profile, numLabelUnits map[string]string, cfg conf

 		SampleValue:       value,
 		SampleMeanDivisor: meanDiv,
-		SampleType:        stype,
+		SampleType:        sample.Type,
 		SampleUnit:        sample.Unit,

 		OutputUnit: cfg.Unit,
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
index 0809cd0814..cc3197148d 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
@@ -110,7 +110,14 @@ func fetchProfiles(s *source, o *plugin.Options) (*profile.Profile, error) {

 		tempFile, err := newTempFile(dir, prefix, ".pb.gz")
 		if err == nil {
-			if err = p.Write(tempFile); err == nil {
+			writeErr := p.Write(tempFile)
+			closeErr := tempFile.Close()
+			switch {
+			case writeErr != nil:
+				err = writeErr
+			case closeErr != nil:
+				err = closeErr
+			default:
 				o.UI.PrintErr("Saved profile in ", tempFile.Name())
 			}
 		}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/graph.html b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/graph.html
index d17a0ea7d0..bc612423c6 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/graph.html
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/graph.html
@@ -12,6 +12,6 @@
     {{.HTMLBody}}
   </div>
   {{template "script" .}}
-  <script>viewer(new URL(window.location.href), {{.Nodes}});</script>
+  <script{{if .CSPNonce}} nonce="{{.CSPNonce}}"{{end}}>viewer(new URL(window.location.href), {{.Nodes}});</script>
 </body>
 </html>
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/plaintext.html b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/plaintext.html
index 9791cc7718..2741ae2a8e 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/plaintext.html
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/plaintext.html
@@ -13,6 +13,6 @@
     </pre>
   </div>
   {{template "script" .}}
-  <script>viewer(new URL(window.location.href), null);</script>
+  <script{{if .CSPNonce}} nonce="{{.CSPNonce}}"{{end}}>viewer(new URL(window.location.href), null);</script>
 </body>
 </html>
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/source.html b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/source.html
index b676ce2054..3a99e479d9 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/source.html
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/source.html
@@ -24,7 +24,7 @@
     {{range .Funcs -}}
       <h2>{{.Name}}</h2>{{"" -}}
       <p class="filename">{{.File}}</p>{{"\n" -}}
-      <pre onClick="pprof_toggle_asm(event)">{{"\n" -}}
+      <pre>{{"\n" -}}
         {{printf "  Total:  %10s %10s (flat, cum) %s" .Flat .Cumulative .Percent -}}
         {{range .Lines -}}{{"\n" -}}
           {{/* source line */ -}}
@@ -66,7 +66,7 @@
   {{if not .Standalone}}{{"\n  " -}}
     </div>{{"\n" -}}
     {{template "script" .}}{{"\n" -}}
-    <script>viewer(new URL(window.location.href), null);</script>{{"" -}}
+    <script{{if .CSPNonce}} nonce="{{.CSPNonce}}"{{end}}>viewer(new URL(window.location.href), null);</script>{{"" -}}
   {{end}}
 </body>
 </html>
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.html b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.html
index a4e4077ed8..430a33a420 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.html
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/stacks.html
@@ -27,8 +27,8 @@
     <a title="{{.Help.show_from}}" id="action-showfrom" href="?">Show from</a>
   </div>
   {{template "script" .}}
-  {{template "stacks_js"}}
-  <script>
+  {{template "stacks_js" .}}
+  <script{{if .CSPNonce}} nonce="{{.CSPNonce}}"{{end}}>
     pprofUnitDefs = {{.UnitDefs}};
     stackViewer({{.Stacks}}, {{.Nodes}});
   </script>
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/top.html b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/top.html
index 86d9fcbdb0..a50cb8ca44 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/html/top.html
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/html/top.html
@@ -26,7 +26,7 @@
     </table>
   </div>
   {{template "script" .}}
-  <script>
+  <script{{if .CSPNonce}} nonce="{{.CSPNonce}}"{{end}}>
     function makeTopTable(total, entries) {
       const rows = document.getElementById('rows');
       if (rows == null) return;
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go
index b6c8776ff8..ed48368bf8 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go
@@ -24,7 +24,7 @@ import (
 // newTempFile returns a new output file in dir with the provided prefix and suffix.
 func newTempFile(dir, prefix, suffix string) (*os.File, error) {
 	for index := 1; index < 10000; index++ {
-		switch f, err := os.OpenFile(filepath.Join(dir, fmt.Sprintf("%s%03d%s", prefix, index, suffix)), os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666); {
+		switch f, err := os.OpenFile(filepath.Join(dir, fmt.Sprintf("%s%03d%s", prefix, index, suffix)), os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600); {
 		case err == nil:
 			return f, nil
 		case !os.IsExist(err):
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
index 0b8630bcf1..c812f3aeed 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
@@ -59,7 +59,7 @@ func addTemplates(templates *template.Template) {
 		return `<style type="text/css">` + "\n" + loadFile(fname) + `</style>` + "\n"
 	}
 	loadJS := func(fname string) string {
-		return `<script>` + "\n" + loadFile(fname) + `</script>` + "\n"
+		return `<script{{if .CSPNonce}} nonce="{{.CSPNonce}}"{{end}}>` + "\n" + loadFile(fname) + `</script>` + "\n"
 	}

 	// Define a named template with specified contents.
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
index a747635c59..98502cdcf1 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
@@ -16,6 +16,7 @@ package driver

 import (
 	"bytes"
+	"crypto/rand"
 	"fmt"
 	"html/template"
 	"io"
@@ -25,7 +26,6 @@ import (
 	gourl "net/url"
 	"os"
 	"os/exec"
-	"slices"
 	"strconv"
 	"strings"
 	"time"
@@ -82,7 +82,8 @@ type webArgs struct {
 	SampleTypes []string
 	Legend      []string
 	DocURL      string
-	Standalone  bool // True for command-line generation of HTML
+	Standalone  bool   // True for command-line generation of HTML
+	CSPNonce    string // Script nonce of the CSP header; set if and only if Standalone is false
 	Help        map[string]string
 	Nodes       []string
 	HTMLBody    template.HTML
@@ -132,11 +133,12 @@ func serveWebInterface(hostport string, p *profile.Profile, o *plugin.Options, d
 			"/source":       http.HandlerFunc(ui.source),
 			"/peek":         http.HandlerFunc(ui.peek),
 			"/flamegraph":   http.HandlerFunc(ui.stackView),
-			"/saveconfig":   http.HandlerFunc(ui.saveConfig),
-			"/deleteconfig": http.HandlerFunc(ui.deleteConfig),
+			"/saveconfig":   configHandler(http.MethodPost, ui.saveConfig),
+			"/deleteconfig": configHandler(http.MethodDelete, ui.deleteConfig),
 			"/download": http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 				w.Header().Set("Content-Type", "application/vnd.google.protobuf+gzip")
 				w.Header().Set("Content-Disposition", "attachment;filename=profile.pb.gz")
+				w.Header().Set("X-Content-Type-Options", "nosniff")
 				p.Write(w)
 			}),
 			// Keep legacy URLs working.
@@ -187,15 +189,18 @@ func defaultWebServer(args *plugin.HTTPServerArgs) error {
 	if err != nil {
 		return err
 	}
+	s := &http.Server{Handler: webServerHandler(args)}
+	return s.Serve(ln)
+}
+
+func webServerHandler(args *plugin.HTTPServerArgs) http.Handler {
 	isLocal := isLocalhost(args.Host)
 	handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
-		if isLocal {
-			// Only allow local clients
-			host, _, err := net.SplitHostPort(req.RemoteAddr)
-			if err != nil || !isLocalhost(host) {
-				http.Error(w, "permission denied", http.StatusForbidden)
-				return
-			}
+		if isLocal && (!isLocalhostHostPort(req.RemoteAddr) || !isLocalhostHostPort(req.Host)) {
+			// Require both a loopback peer and a local Host header (to block DNS
+			// rebinding from untrusted web pages open in the user's browser).
+			http.Error(w, "permission denied", http.StatusForbidden)
+			return
 		}
 		h := args.Handlers[req.URL.Path]
 		if h == nil {
@@ -212,8 +217,7 @@ func defaultWebServer(args *plugin.HTTPServerArgs) error {
 	mux := http.NewServeMux()
 	mux.Handle("/ui/", http.StripPrefix("/ui", handler))
 	mux.Handle("/", redirectWithQuery("/ui", http.StatusTemporaryRedirect))
-	s := &http.Server{Handler: mux}
-	return s.Serve(ln)
+	return mux
 }

 // redirectWithQuery responds with a given redirect code, preserving query
@@ -229,7 +233,15 @@ func redirectWithQuery(path string, code int) http.HandlerFunc {
 }

 func isLocalhost(host string) bool {
-	return slices.Contains([]string{"localhost", "127.0.0.1", "[::1]", "::1"}, host)
+	host = strings.TrimPrefix(strings.TrimSuffix(host, "]"), "[")
+	return strings.EqualFold(host, "localhost") || net.ParseIP(host).IsLoopback()
+}
+
+func isLocalhostHostPort(hostport string) bool {
+	if host, _, err := net.SplitHostPort(hostport); err == nil {
+		hostport = host
+	}
+	return isLocalhost(hostport)
 }

 func openBrowser(url string, o *plugin.Options) {
@@ -283,6 +295,11 @@ func (ui *webInterface) makeReport(w http.ResponseWriter, req *http.Request,

 // renderHTML generates html using the named template based on the contents of data.
 func renderHTML(dst io.Writer, tmpl string, rpt *report.Report, errList, legend []string, data webArgs) error {
+	// Pages served by the web UI need a nonce to run their scripts under the
+	// Content-Security-Policy, and standalone pages have no such policy.
+	if data.Standalone != (data.CSPNonce == "") {
+		return fmt.Errorf("internal error: Standalone is %t but CSPNonce is %q", data.Standalone, data.CSPNonce)
+	}
 	file := getFromLegend(legend, "File: ", "unknown")
 	profile := getFromLegend(legend, "Type: ", "unknown")
 	data.Title = file + " " + profile
@@ -296,6 +313,8 @@ func renderHTML(dst io.Writer, tmpl string, rpt *report.Report, errList, legend
 // render responds with html generated by passing data to the named template.
 func (ui *webInterface) render(w http.ResponseWriter, req *http.Request, tmpl string,
 	rpt *report.Report, errList, legend []string, data webArgs) {
+	nonce := rand.Text()
+	data.CSPNonce = nonce
 	data.SampleTypes = sampleTypes(ui.prof)
 	data.Help = ui.help
 	data.Configs = configMenu(ui.settingsFile, *req.URL)
@@ -305,7 +324,11 @@ func (ui *webInterface) render(w http.ResponseWriter, req *http.Request, tmpl st
 		ui.options.UI.PrintErr(err)
 		return
 	}
-	w.Header().Set("Content-Type", "text/html")
+	w.Header().Set("Content-Type", "text/html; charset=utf-8")
+	w.Header().Set("X-Content-Type-Options", "nosniff")
+	w.Header().Set("Content-Security-Policy", fmt.Sprintf(
+		"default-src 'self'; script-src 'nonce-%s'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; object-src 'none'; base-uri 'none'; form-action 'none'",
+		nonce))
 	w.Write(html.Bytes())
 }

@@ -449,6 +472,21 @@ func (ui *webInterface) peek(w http.ResponseWriter, req *http.Request) {
 	})
 }

+// configHandler wraps a handler that modifies the settings file. It only
+// accepts the given method and rejects cross-origin browser requests, so
+// that other web sites open in the user's browser cannot change or delete
+// saved configurations.
+func configHandler(method string, h http.HandlerFunc) http.Handler {
+	return http.NewCrossOriginProtection().Handler(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
+		if req.Method != method {
+			w.Header().Set("Allow", method)
+			http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
+			return
+		}
+		h(w, req)
+	}))
+}
+
 // saveConfig saves URL configuration.
 func (ui *webInterface) saveConfig(w http.ResponseWriter, req *http.Request) {
 	if err := setConfig(ui.settingsFile, *req.URL); err != nil {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go b/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go
index d704fc4e13..79b47983d2 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go
@@ -21,6 +21,7 @@ import (
 	"path/filepath"
 	"strings"

+	"github.com/google/pprof/internal/dotwriter"
 	"github.com/google/pprof/internal/measurement"
 )

@@ -32,11 +33,18 @@ type DotAttributes struct {

 // DotNodeAttributes contains Node specific visualization options.
 type DotNodeAttributes struct {
-	Shape       string                 // The optional shape of the node when rendered visually
-	Bold        bool                   // If the node should be bold or not
-	Peripheries int                    // An optional number of borders to place around a node
-	URL         string                 // An optional url link to add to a node
-	Formatter   func(*NodeInfo) string // An optional formatter for the node's label
+	// Shape is the optional shape of the node when rendered visually.
+	Shape string
+	// Bold indicates if the node should be bold or not.
+	Bold bool
+	// Peripheries is an optional number of borders to place around a node.
+	Peripheries int
+	// URL is an optional URL link to add to a node.
+	URL string
+	// Formatter formats the node's label prefix. Its output is treated as
+	// untrusted plain text: ComposeDot DOT-escapes each line while preserving
+	// newline ("\n") characters as centered DOT line breaks (\n).
+	Formatter func(*NodeInfo) string
 }

 // DotConfig contains attributes about how a graph should be
@@ -52,14 +60,21 @@ type DotConfig struct {

 const maxNodelets = 4 // Number of nodelets for labels (both numeric and non)

-// ComposeDot creates and writes a in the DOT format to the writer, using
+// ComposeDot creates and writes a graph in the DOT format to the writer, using
 // the configurations given.
 func ComposeDot(w io.Writer, g *Graph, a *DotAttributes, c *DotConfig) {
-	builder := &builder{w, a, c}
+	graphname := "unnamed"
+	if c.Title != "" {
+		graphname = c.Title
+	}
+	dw := dotwriter.Begin(w, graphname)
+	defer dw.End()
+	dw.Node("node",
+		dotwriter.Attr{Key: "style", Val: dotwriter.ID("filled")},
+		dotwriter.Attr{Key: "fillcolor", Val: "#f8f8f8"},
+	)

-	// Begin constructing DOT by adding a title and legend.
-	builder.start()
-	defer builder.finish()
+	builder := &builder{dw: dw, attributes: a, config: c}
 	builder.addLegend()

 	if len(g.Nodes) == 0 {
@@ -97,28 +112,13 @@ func ComposeDot(w io.Writer, g *Graph, a *DotAttributes, c *DotConfig) {
 	}
 }

-// builder wraps an io.Writer and understands how to compose DOT formatted elements.
+// builder composes DOT elements into a dotwriter.Writer.
 type builder struct {
-	io.Writer
+	dw         *dotwriter.Writer
 	attributes *DotAttributes
 	config     *DotConfig
 }

-// start generates a title and initial node in DOT format.
-func (b *builder) start() {
-	graphname := "unnamed"
-	if b.config.Title != "" {
-		graphname = b.config.Title
-	}
-	fmt.Fprintln(b, `digraph "`+graphname+`" {`)
-	fmt.Fprintln(b, `node [style=filled fillcolor="#f8f8f8"]`)
-}
-
-// finish closes the opening curly bracket in the constructed DOT buffer.
-func (b *builder) finish() {
-	fmt.Fprintln(b, "}")
-}
-
 // addLegend generates a legend in DOT format.
 func (b *builder) addLegend() {
 	labels := b.config.Labels
@@ -126,49 +126,52 @@ func (b *builder) addLegend() {
 		return
 	}
 	title := labels[0]
-	fmt.Fprintf(b, `subgraph cluster_L { "%s" [shape=box fontsize=16`, escapeForDot(title))
-	fmt.Fprintf(b, ` label="%s\l"`, strings.Join(escapeAllForDot(labels), `\l`))
+	attrs := []dotwriter.Attr{
+		{Key: "shape", Val: dotwriter.ID("box")},
+		{Key: "fontsize", Val: 16},
+		{Key: "label", Val: dotwriter.LinesLeft(labels)},
+	}
 	if b.config.LegendURL != "" {
-		fmt.Fprintf(b, ` URL="%s" target="_blank"`, b.config.LegendURL)
+		attrs = append(attrs, dotwriter.Attr{Key: "URL", Val: b.config.LegendURL}, dotwriter.Attr{Key: "target", Val: "_blank"})
 	}
 	if b.config.Title != "" {
-		fmt.Fprintf(b, ` tooltip="%s"`, b.config.Title)
+		attrs = append(attrs, dotwriter.Attr{Key: "tooltip", Val: b.config.Title})
 	}
-	fmt.Fprintf(b, "] }\n")
+	b.dw.Legend(title, attrs...)
 }

 // addNode generates a graph node in DOT format.
 func (b *builder) addNode(node *Node, nodeID int, maxFlat float64) {
 	flat, cum := node.FlatValue(), node.CumValue()
-	attrs := b.attributes.Nodes[node]
+	nodeAttrs := b.attributes.Nodes[node]

 	// Populate label for node.
-	var label string
-	if attrs != nil && attrs.Formatter != nil {
-		label = attrs.Formatter(&node.Info)
-	} else {
-		label = multilinePrintableName(&node.Info)
+	formatter := multilinePrintableName
+	if nodeAttrs != nil && nodeAttrs.Formatter != nil {
+		formatter = nodeAttrs.Formatter
 	}
+	label := dotwriter.LinesCenter(strings.Split(formatter(&node.Info), "\n"))

 	flatValue := b.config.FormatValue(flat)
 	if flat != 0 {
-		label = label + fmt.Sprintf(`%s (%s)`,
+		flatLine := dotwriter.Escaped(fmt.Sprintf(`%s (%s)`,
 			flatValue,
-			strings.TrimSpace(measurement.Percentage(flat, b.config.Total)))
+			strings.TrimSpace(measurement.Percentage(flat, b.config.Total))))
+		label = dotwriter.Join(label, flatLine)
 	} else {
-		label = label + "0"
+		label = dotwriter.Join(label, dotwriter.Escaped("0"))
 	}
 	cumValue := flatValue
 	if cum != flat {
+		cumLine := dotwriter.Escaped(fmt.Sprintf(`of %s (%s)`,
+			b.config.FormatValue(cum),
+			strings.TrimSpace(measurement.Percentage(cum, b.config.Total))))
+		cumValue = b.config.FormatValue(cum)
 		if flat != 0 {
-			label = label + `\n`
+			label = dotwriter.JoinLinesCenter(label, cumLine)
 		} else {
-			label = label + " "
+			label = dotwriter.Join(label, dotwriter.Escaped(" "), cumLine)
 		}
-		cumValue = b.config.FormatValue(cum)
-		label = label + fmt.Sprintf(`of %s (%s)`,
-			cumValue,
-			strings.TrimSpace(measurement.Percentage(cum, b.config.Total)))
 	}

 	// Scale font sizes from 8 to 24 based on percentage of flat frequency.
@@ -181,40 +184,41 @@ func (b *builder) addNode(node *Node, nodeID int, maxFlat float64) {

 	// Determine node shape.
 	shape := "box"
-	if attrs != nil && attrs.Shape != "" {
-		shape = attrs.Shape
+	if nodeAttrs != nil && nodeAttrs.Shape != "" {
+		shape = nodeAttrs.Shape
 	}

-	// Create DOT attribute for node.
-	attr := fmt.Sprintf(`label="%s" id="node%d" fontsize=%d shape=%s tooltip="%s (%s)" color="%s" fillcolor="%s"`,
-		label, nodeID, fontSize, shape, escapeForDot(node.Info.PrintableName()), cumValue,
-		dotColor(float64(node.CumValue())/float64(abs64(b.config.Total)), false),
-		dotColor(float64(node.CumValue())/float64(abs64(b.config.Total)), true))
+	cumScore := float64(node.CumValue()) / float64(abs64(b.config.Total))
+	attrs := []dotwriter.Attr{
+		{Key: "label", Val: label},
+		{Key: "id", Val: fmt.Sprintf("node%d", nodeID)},
+		{Key: "fontsize", Val: fontSize},
+		{Key: "shape", Val: dotwriter.ID(shape)},
+		{Key: "tooltip", Val: fmt.Sprintf("%s (%s)", node.Info.PrintableName(), cumValue)},
+		{Key: "color", Val: dotColor(cumScore, false)},
+		{Key: "fillcolor", Val: dotColor(cumScore, true)},
+	}

 	// Add on extra attributes if provided.
-	if attrs != nil {
-		// Make bold if specified.
-		if attrs.Bold {
-			attr += ` style="bold,filled"`
+	if nodeAttrs != nil {
+		if nodeAttrs.Bold {
+			attrs = append(attrs, dotwriter.Attr{Key: "style", Val: "bold,filled"})
 		}
-
-		// Add peripheries if specified.
-		if attrs.Peripheries != 0 {
-			attr += fmt.Sprintf(` peripheries=%d`, attrs.Peripheries)
+		if nodeAttrs.Peripheries != 0 {
+			attrs = append(attrs, dotwriter.Attr{Key: "peripheries", Val: nodeAttrs.Peripheries})
 		}
-
-		// Add URL if specified. target="_blank" forces the link to open in a new tab.
-		if attrs.URL != "" {
-			attr += fmt.Sprintf(` URL="%s" target="_blank"`, attrs.URL)
+		if nodeAttrs.URL != "" {
+			// target="_blank" forces the link to open in a new tab.
+			attrs = append(attrs, dotwriter.Attr{Key: "URL", Val: nodeAttrs.URL}, dotwriter.Attr{Key: "target", Val: "_blank"})
 		}
 	}

-	fmt.Fprintf(b, "N%d [%s]\n", nodeID, attr)
+	b.dw.Node(dotwriter.ID(fmt.Sprintf("N%d", nodeID)), attrs...)
 }

 // addNodelets generates the DOT boxes for the node tags if they exist.
 func (b *builder) addNodelets(node *Node, nodeID int) bool {
-	var nodelets string
+	wrote := false

 	// Populate two Tag slices, one for LabelTags and one for NumericTags.
 	var ts []*Tag
@@ -238,6 +242,7 @@ func (b *builder) addNodelets(node *Node, nodeID int) bool {
 	if len(ts) > maxNodelets {
 		ts = ts[:maxNodelets]
 	}
+	parentID := dotwriter.ID(fmt.Sprintf("N%d", nodeID))
 	for i, t := range ts {
 		w := t.CumValue()
 		if flatTags {
@@ -246,83 +251,113 @@ func (b *builder) addNodelets(node *Node, nodeID int) bool {
 		if w == 0 {
 			continue
 		}
+		wrote = true
 		weight := b.config.FormatValue(w)
-		nodelets += fmt.Sprintf(`N%d_%d [label = "%s" id="N%d_%d" fontsize=8 shape=box3d tooltip="%s"]`+"\n", nodeID, i, t.Name, nodeID, i, weight)
-		nodelets += fmt.Sprintf(`N%d -> N%d_%d [label=" %s" weight=100 tooltip="%s" labeltooltip="%s"]`+"\n", nodeID, nodeID, i, weight, weight, weight)
+		id := dotwriter.ID(fmt.Sprintf("N%d_%d", nodeID, i))
+		label := dotwriter.LinesCenter(strings.Split(t.Name, "\n"))
+		b.dw.Node(id,
+			dotwriter.Attr{Key: "label", Val: label},
+			dotwriter.Attr{Key: "id", Val: string(id)},
+			dotwriter.Attr{Key: "fontsize", Val: 8},
+			dotwriter.Attr{Key: "shape", Val: dotwriter.ID("box3d")},
+			dotwriter.Attr{Key: "tooltip", Val: weight},
+		)
+		b.dw.Edge(parentID, id,
+			dotwriter.Attr{Key: "label", Val: " " + weight},
+			dotwriter.Attr{Key: "weight", Val: 100},
+			dotwriter.Attr{Key: "tooltip", Val: weight},
+			dotwriter.Attr{Key: "labeltooltip", Val: weight},
+		)
 		if nts := lnts[t.Name]; nts != nil {
-			nodelets += b.numericNodelets(nts, maxNodelets, flatTags, fmt.Sprintf(`N%d_%d`, nodeID, i))
+			b.numericNodelets(nts, maxNodelets, flatTags, id)
 		}
 	}

 	if nts := lnts[""]; nts != nil {
-		nodelets += b.numericNodelets(nts, maxNodelets, flatTags, fmt.Sprintf(`N%d`, nodeID))
+		if b.numericNodelets(nts, maxNodelets, flatTags, parentID) {
+			wrote = true
+		}
 	}

-	fmt.Fprint(b, nodelets)
-	return nodelets != ""
+	return wrote
 }

-func (b *builder) numericNodelets(nts []*Tag, maxNumNodelets int, flatTags bool, source string) string {
-	nodelets := ""
-
+func (b *builder) numericNodelets(nts []*Tag, maxNumNodelets int, flatTags bool, source dotwriter.ID) bool {
+	wrote := false
 	// Collapse numeric labels into maxNumNodelets buckets, of the form:
 	// 1MB..2MB, 3MB..5MB, ...
 	for j, t := range b.collapsedTags(nts, maxNumNodelets, flatTags) {
-		w, attr := t.CumValue(), ` style="dotted"`
+		w, dotted := t.CumValue(), true
 		if flatTags || t.FlatValue() == t.CumValue() {
-			w, attr = t.FlatValue(), ""
+			w, dotted = t.FlatValue(), false
+		}
+		if w == 0 {
+			continue
+		}
+		wrote = true
+		weight := b.config.FormatValue(w)
+		id := dotwriter.ID(fmt.Sprintf("N%s_%d", source, j))
+		b.dw.Node(id,
+			dotwriter.Attr{Key: "label", Val: t.Name},
+			dotwriter.Attr{Key: "id", Val: string(id)},
+			dotwriter.Attr{Key: "fontsize", Val: 8},
+			dotwriter.Attr{Key: "shape", Val: dotwriter.ID("box3d")},
+			dotwriter.Attr{Key: "tooltip", Val: weight},
+		)
+		edgeAttrs := []dotwriter.Attr{
+			{Key: "label", Val: " " + weight},
+			{Key: "weight", Val: 100},
+			{Key: "tooltip", Val: weight},
+			{Key: "labeltooltip", Val: weight},
 		}
-		if w != 0 {
-			weight := b.config.FormatValue(w)
-			nodelets += fmt.Sprintf(`N%s_%d [label = "%s" id="N%s_%d" fontsize=8 shape=box3d tooltip="%s"]`+"\n", source, j, t.Name, source, j, weight)
-			nodelets += fmt.Sprintf(`%s -> N%s_%d [label=" %s" weight=100 tooltip="%s" labeltooltip="%s"%s]`+"\n", source, source, j, weight, weight, weight, attr)
+		if dotted {
+			edgeAttrs = append(edgeAttrs, dotwriter.Attr{Key: "style", Val: "dotted"})
 		}
+		b.dw.Edge(source, id, edgeAttrs...)
 	}
-	return nodelets
+	return wrote
 }

 // addEdge generates a graph edge in DOT format.
 func (b *builder) addEdge(edge *Edge, from, to int, hasNodelets bool) {
-	var inline string
+	w := b.config.FormatValue(edge.WeightValue())
+	label := dotwriter.Escaped(" " + w)
 	if edge.Inline {
-		inline = `\n (inline)`
+		label = dotwriter.JoinLinesCenter(label, dotwriter.Escaped(" (inline)"))
 	}
-	w := b.config.FormatValue(edge.WeightValue())
-	attr := fmt.Sprintf(`label=" %s%s"`, w, inline)
+	attrs := []dotwriter.Attr{{Key: "label", Val: label}}
 	if b.config.Total != 0 {
 		// Note: edge.weight > b.config.Total is possible for profile diffs.
 		if weight := 1 + int(min64(abs64(edge.WeightValue()*100/b.config.Total), 100)); weight > 1 {
-			attr = fmt.Sprintf(`%s weight=%d`, attr, weight)
+			attrs = append(attrs, dotwriter.Attr{Key: "weight", Val: weight})
 		}
 		if width := 1 + int(min64(abs64(edge.WeightValue()*5/b.config.Total), 5)); width > 1 {
-			attr = fmt.Sprintf(`%s penwidth=%d`, attr, width)
+			attrs = append(attrs, dotwriter.Attr{Key: "penwidth", Val: width})
 		}
-		attr = fmt.Sprintf(`%s color="%s"`, attr,
-			dotColor(float64(edge.WeightValue())/float64(abs64(b.config.Total)), false))
+		color := dotColor(float64(edge.WeightValue())/float64(abs64(b.config.Total)), false)
+		attrs = append(attrs, dotwriter.Attr{Key: "color", Val: color})
 	}
 	arrow := "->"
 	if edge.Residual {
 		arrow = "..."
 	}
-	tooltip := fmt.Sprintf(`"%s %s %s (%s)"`,
-		escapeForDot(edge.Src.Info.PrintableName()), arrow,
-		escapeForDot(edge.Dest.Info.PrintableName()), w)
-	attr = fmt.Sprintf(`%s tooltip=%s labeltooltip=%s`, attr, tooltip, tooltip)
+	tooltip := fmt.Sprintf("%s %s %s (%s)",
+		edge.Src.Info.PrintableName(), arrow, edge.Dest.Info.PrintableName(), w)
+	attrs = append(attrs, dotwriter.Attr{Key: "tooltip", Val: tooltip}, dotwriter.Attr{Key: "labeltooltip", Val: tooltip})

 	if edge.Residual {
-		attr = attr + ` style="dotted"`
+		attrs = append(attrs, dotwriter.Attr{Key: "style", Val: "dotted"})
 	}
-
 	if hasNodelets {
 		// Separate children further if source has tags.
-		attr = attr + " minlen=2"
+		attrs = append(attrs, dotwriter.Attr{Key: "minlen", Val: 2})
 	}

-	fmt.Fprintf(b, "N%d -> N%d [%s]\n", from, to, attr)
+	b.dw.Edge(dotwriter.ID(fmt.Sprintf("N%d", from)), dotwriter.ID(fmt.Sprintf("N%d", to)), attrs...)
 }

 // dotColor returns a color for the given score (between -1.0 and
-// 1.0), with -1.0 colored green, 0.0 colored grey, and 1.0 colored
+// 1.0), with -1.0 colored blue, 0.0 colored grey, and 1.0 colored
 // red. If isBackground is true, then a light (low-saturation)
 // color is returned (suitable for use as a background color);
 // otherwise, a darker color is returned (suitable for use as a
@@ -371,28 +406,46 @@ func dotColor(score float64, isBackground bool) string {

 	var r, g, b float64 // red, green, blue
 	if score < 0.0 {
-		g = value
+		b = value
 		r = value * (1 + saturation*score)
+		g = value * (1 + saturation*score)
 	} else {
 		r = value
 		g = value * (1 - saturation*score)
+		b = value * (1 - saturation)
 	}
-	b = value * (1 - saturation)
 	return fmt.Sprintf("#%02x%02x%02x", uint8(r*255.0), uint8(g*255.0), uint8(b*255.0))
 }

 func multilinePrintableName(info *NodeInfo) string {
 	infoCopy := *info
-	infoCopy.Name = escapeForDot(ShortenFunctionName(infoCopy.Name))
-	infoCopy.Name = strings.ReplaceAll(infoCopy.Name, "::", `\n`)
-	// Go type parameters are reported as "[...]" by Go pprof profiles.
-	// Keep this ellipsis rather than replacing with newlines below.
-	infoCopy.Name = strings.ReplaceAll(infoCopy.Name, "[...]", "[…]")
-	infoCopy.Name = strings.ReplaceAll(infoCopy.Name, ".", `\n`)
+	infoCopy.Name = ShortenFunctionName(infoCopy.Name)
 	if infoCopy.File != "" {
 		infoCopy.File = filepath.Base(infoCopy.File)
 	}
-	return strings.Join(infoCopy.NameComponents(), `\n`) + `\n`
+	if infoCopy.Objfile != "" {
+		infoCopy.Objfile = filepath.Base(infoCopy.Objfile)
+	}
+	var lines []string
+	for _, c := range infoCopy.NameComponents() {
+		if infoCopy.Name != "" && c == infoCopy.Name {
+			lines = append(lines, splitFunctionName(c)...)
+		} else {
+			lines = append(lines, c)
+		}
+	}
+	return strings.Join(lines, "\n") + "\n"
+}
+
+func splitFunctionName(name string) []string {
+	// Go type parameters are reported as "[...]" by Go pprof profiles.
+	// Keep this ellipsis rather than splitting on its dots below.
+	name = strings.ReplaceAll(name, "[...]", "[…]")
+	var parts []string
+	for _, seg := range strings.Split(name, "::") {
+		parts = append(parts, strings.Split(seg, ".")...)
+	}
+	return parts
 }

 // collapsedTags trims and sorts a slice of tags.
@@ -476,19 +529,3 @@ func min64(a, b int64) int64 {
 	}
 	return b
 }
-
-// escapeAllForDot applies escapeForDot to all strings in the given slice.
-func escapeAllForDot(in []string) []string {
-	var out = make([]string, len(in))
-	for i := range in {
-		out[i] = escapeForDot(in[i])
-	}
-	return out
-}
-
-// escapeForDot escapes double quotes and backslashes, and replaces Graphviz's
-// "center" character (\n) with a left-justified character.
-// See https://graphviz.org/docs/attr-types/escString/ for more info.
-func escapeForDot(str string) string {
-	return strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(str, `\`, `\\`), `"`, `\"`), "\n", `\l`)
-}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go b/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
index ee7a700174..ce7c51cef1 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
@@ -548,7 +548,7 @@ func joinLabels(s *profile.Sample) string {
 		}
 	}
 	sort.Strings(labels)
-	return strings.Join(labels, `\n`)
+	return strings.Join(labels, "\n")
 }

 // isNegative returns true if the node is considered as "negative" for the
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go b/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
index 479235c0a6..d70e8e6019 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
@@ -21,6 +21,7 @@ import (
 	"slices"
 	"strings"
 	"time"
+	"unicode/utf8"

 	"github.com/google/pprof/profile"
 )
@@ -209,7 +210,9 @@ func (ut UnitType) findByAlias(alias string) *Unit {
 // specified alias. It returns nil if the unit with such alias is not found.
 func (ut UnitType) sniffUnit(unit string) *Unit {
 	unit = strings.ToLower(unit)
-	if len(unit) > 2 {
+	// Count runes rather than bytes so that multi-byte aliases such as "μs"
+	// are not mistaken for a plural form and stripped down to "μ".
+	if utf8.RuneCountInString(unit) > 2 {
 		unit = strings.TrimSuffix(unit, "s")
 	}
 	return ut.findByAlias(unit)
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go b/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go
index e6f0827633..914afd2ad0 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go
@@ -114,8 +114,8 @@ type ObjTool interface {
 	// corresponding to the start address.
 	Open(file string, start, limit, offset uint64, relocationSymbol string) (ObjFile, error)

-	// Disasm disassembles the named object file, starting at
-	// the start address and stopping at (before) the end address.
+	// Disasm disassembles the named object file in the address range
+	// [start, end), including start and excluding end.
 	Disasm(file string, start, end uint64, intelSyntax bool) ([]Inst, error)
 }

@@ -150,7 +150,7 @@ type ObjFile interface {
 	// If r is not nil, Symbols restricts the list to symbols
 	// with names matching the regular expression.
 	// If addr is not zero, Symbols restricts the list to symbols
-	// containing that address.
+	// containing that address in the inclusive range [Sym.Start, Sym.End].
 	Symbols(r *regexp.Regexp, addr uint64) ([]*Sym, error)

 	// Close closes the file, releasing associated resources.
@@ -166,7 +166,8 @@ type Frame struct {
 	StartLine int    // start line of function (if available)
 }

-// A Sym describes a single symbol in an object file.
+// A Sym describes a single symbol in an object file. Its address range
+// [Start, End] includes both endpoints.
 type Sym struct {
 	Name  []string // names of symbol (many if symbol was dedup'ed)
 	File  string   // object file containing symbol
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/report/report.go b/src/cmd/vendor/github.com/google/pprof/internal/report/report.go
index 73a601c3e3..8bf6457bca 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/report/report.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/report/report.go
@@ -306,9 +306,21 @@ func printProto(w io.Writer, rpt *Report) error {
 			}
 		}
 	}
+	// Make the selected sample type the default of the saved profile, so that
+	// its consumers open on the same sample type.
+	p.DefaultSampleType = o.SampleType
 	return p.Write(w)
 }

+// sampleTypeLabel returns the sample type as displayed in reports, i.e. with a
+// "mean_" prefix if the report shows per-sample means.
+func (o *Options) sampleTypeLabel() string {
+	if o.SampleMeanDivisor != nil {
+		return "mean_" + o.SampleType
+	}
+	return o.SampleType
+}
+
 // printTopProto writes a list of the hottest routines in a profile as a profile.proto.
 func printTopProto(w io.Writer, rpt *Report) error {
 	p := rpt.prof
@@ -454,7 +466,13 @@ func PrintAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFuncs int) e
 		flatSum, cumSum := sns.Sum()

 		// Get the function assembly.
-		insts, err := obj.Disasm(s.sym.File, s.sym.Start, s.sym.End, o.IntelSyntax)
+		// Symbol ends are inclusive, but Disasm expects an exclusive end.
+		// Keep the unknown end of the final nm symbol from wrapping to zero.
+		end := s.sym.End
+		if end != ^uint64(0) {
+			end++
+		}
+		insts, err := obj.Disasm(s.sym.File, s.sym.Start, end, o.IntelSyntax)
 		if err != nil {
 			return err
 		}
@@ -523,7 +541,7 @@ func symbolsFromBinaries(prof *profile.Profile, g *graph.Graph, rx *regexp.Regex
 	// samples and are matched to the regexp.
 	fileHasSamplesAndMatched := make(map[string]bool)
 	for _, n := range g.Nodes {
-		if name := n.Info.PrintableName(); rx.MatchString(name) && n.Info.Objfile != "" {
+		if rx.MatchString(n.Info.Name) && n.Info.Objfile != "" {
 			fileHasSamplesAndMatched[n.Info.Objfile] = true
 		}
 	}
@@ -588,12 +606,14 @@ func (o orderSyms) Less(i, j int) bool { return o.less(o.v[i], o.v[j]) }
 func (o orderSyms) Swap(i, j int)      { o.v[i], o.v[j] = o.v[j], o.v[i] }

 // nodesPerSymbol classifies nodes into a group of symbols.
+// A node belongs to a symbol when its object address is in the inclusive
+// range [sym.Start, sym.End].
 func nodesPerSymbol(ns graph.Nodes, symbols []*objSymbol) map[*objSymbol]graph.Nodes {
 	symNodes := make(map[*objSymbol]graph.Nodes)
 	for _, s := range symbols {
 		// Gather samples for this symbol.
 		for _, n := range ns {
-			if address, err := s.file.ObjAddr(n.Info.Address); err == nil && address >= s.sym.Start && address < s.sym.End {
+			if address, err := s.file.ObjAddr(n.Info.Address); err == nil && address >= s.sym.Start && address <= s.sym.End {
 				symNodes[s] = append(symNodes[s], n)
 			}
 		}
@@ -938,7 +958,7 @@ func printCallgrind(w io.Writer, rpt *Report) error {
 	nodeNames := getDisambiguatedNames(g)

 	fmt.Fprintln(w, "positions: instr line")
-	fmt.Fprintln(w, "events:", o.SampleType+"("+o.OutputUnit+")")
+	fmt.Fprintln(w, "events:", o.sampleTypeLabel()+"("+o.OutputUnit+")")

 	objfiles := make(map[string]int)
 	files := make(map[string]int)
@@ -1174,7 +1194,7 @@ func ProfileLabels(rpt *Report) []string {
 		}
 	}
 	if o.SampleType != "" {
-		label = append(label, "Type: "+o.SampleType)
+		label = append(label, "Type: "+o.sampleTypeLabel())
 	}
 	if url := prof.DocURL; url != "" {
 		label = append(label, "Doc: "+url)
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/report/source.go b/src/cmd/vendor/github.com/google/pprof/internal/report/source.go
index 771f500ec1..e11f52515f 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/report/source.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/report/source.go
@@ -307,6 +307,7 @@ func newSourcePrinter(rpt *Report, obj plugin.ObjTool, sourcePath string) *sourc
 	}

 	// Extract sample counts and compute set of interesting functions.
+	seen := make(map[uint64]bool) // Addresses seen in the current sample.
 	for _, sample := range rpt.prof.Sample {
 		value := rpt.options.SampleValue(sample.Value)
 		if rpt.options.SampleMeanDivisor != nil {
@@ -316,6 +317,8 @@ func newSourcePrinter(rpt *Report, obj plugin.ObjTool, sourcePath string) *sourc
 			}
 		}

+		clear(seen)
+
 		// Find call-sites matching sym.
 		for i := len(sample.Location) - 1; i >= 0; i-- {
 			loc := sample.Location[i]
@@ -332,7 +335,12 @@ func newSourcePrinter(rpt *Report, obj plugin.ObjTool, sourcePath string) *sourc
 				addr = sp.synth.address(loc)
 			}

-			cum[addr] += value
+			// Count the sample once per address, even if the address is
+			// on the stack multiple times due to recursion.
+			if !seen[addr] {
+				seen[addr] = true
+				cum[addr] += value
+			}
 			if i == 0 {
 				flat[addr] += value
 			}
@@ -1031,8 +1039,6 @@ func openSourceFile(path, searchPath, trim string) (*os.File, error) {

 // trimPath cleans up a path by removing prefixes that are commonly
 // found on profiles plus configured prefixes.
-// TODO(aalexand): Consider optimizing out the redundant work done in this
-// function if it proves to matter.
 func trimPath(path, trimPath, searchPath string) string {
 	// Keep path variable intact as it's used below to form the return value.
 	sPath, searchPath := filepath.ToSlash(path), filepath.ToSlash(searchPath)
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/report/source_html.go b/src/cmd/vendor/github.com/google/pprof/internal/report/source_html.go
index 614a5ee293..fee720e0d7 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/report/source_html.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/report/source_html.go
@@ -52,20 +52,13 @@ display: none;
 }
 </style>`

-const weblistPageScript = `<script type="text/javascript">
-function pprof_toggle_asm(e) {
-  var target;
-  if (!e) e = window.event;
-  if (e.target) target = e.target;
-  else if (e.srcElement) target = e.srcElement;
-
-  if (target) {
-    var asm = target.nextSibling;
-    if (asm && asm.className == "asm") {
-      asm.style.display = (asm.style.display == "block" ? "" : "block");
-      e.preventDefault();
-      return false;
-    }
+const weblistPageScript = `<script{{if .CSPNonce}} nonce="{{.CSPNonce}}"{{end}} type="text/javascript">
+// Clicking a source line toggles the display of its assembly.
+document.addEventListener("click", function(e) {
+  var asm = e.target.nextSibling;
+  if (asm && asm.className == "asm") {
+    asm.style.display = (asm.style.display == "block" ? "" : "block");
+    e.preventDefault();
   }
-}
+});
 </script>`
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go b/src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go
index dbf20bebe9..b40c91f6f1 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/report/stacks.go
@@ -92,7 +92,7 @@ func (rpt *Report) Stacks() StackSet {
 	s := &StackSet{
 		Total:   rpt.total,
 		Scale:   scale,
-		Type:    rpt.options.SampleType,
+		Type:    rpt.options.sampleTypeLabel(),
 		Unit:    unit,
 		Stacks:  []Stack{},       // Ensure non-nil
 		Sources: []StackSource{}, // Ensure non-nil
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/transport/transport.go b/src/cmd/vendor/github.com/google/pprof/internal/transport/transport.go
index 6c3bd0dfd0..3018a9a1c7 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/transport/transport.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/transport/transport.go
@@ -116,7 +116,8 @@ func (tr *transport) RoundTrip(req *http.Request) (*http.Response, error) {
 		// Make shallow copy of request, and req.URL, so the request's URL can be
 		// modified.
 		r := *req
-		*r.URL = *req.URL
+		u := *req.URL
+		r.URL = &u
 		req = &r
 		tlsConfig.InsecureSkipVerify = true
 		req.URL.Scheme = "https"
diff --git a/src/cmd/vendor/github.com/google/pprof/profile/encode.go b/src/cmd/vendor/github.com/google/pprof/profile/encode.go
index 8ce9d3cf3b..3af74d445d 100644
--- a/src/cmd/vendor/github.com/google/pprof/profile/encode.go
+++ b/src/cmd/vendor/github.com/google/pprof/profile/encode.go
@@ -321,9 +321,29 @@ func (p *Profile) postDecode() error {

 	for _, s := range p.Sample {
 		if len(s.labelX) > 0 {
-			labels := make(map[string][]string, len(s.labelX))
-			numLabels := make(map[string][]int64, len(s.labelX))
-			numUnits := make(map[string][]string, len(s.labelX))
+			var numStr, numNum, numUnit int
+			for _, l := range s.labelX {
+				if l.strX != 0 {
+					numStr++
+				} else if l.numX != 0 || l.unitX != 0 {
+					numNum++
+					if l.unitX != 0 {
+						numUnit++
+					}
+				}
+			}
+			var labels map[string][]string
+			if numStr > 0 {
+				labels = make(map[string][]string, numStr)
+			}
+			var numLabels map[string][]int64
+			if numNum > 0 {
+				numLabels = make(map[string][]int64, numNum)
+			}
+			var numUnits map[string][]string
+			if numUnit > 0 {
+				numUnits = make(map[string][]string, numUnit)
+			}
 			for _, l := range s.labelX {
 				var key, value string
 				key, err = getString(p.stringTable, &l.keyX, err)
@@ -332,10 +352,10 @@ func (p *Profile) postDecode() error {
 					labels[key] = append(labels[key], value)
 				} else if l.numX != 0 || l.unitX != 0 {
 					numValues := numLabels[key]
-					units := numUnits[key]
 					if l.unitX != 0 {
 						var unit string
 						unit, err = getString(p.stringTable, &l.unitX, err)
+						units := numUnits[key]
 						units = padStringArray(units, len(numValues))
 						numUnits[key] = append(units, unit)
 					}
@@ -347,14 +367,17 @@ func (p *Profile) postDecode() error {
 			}
 			if len(numLabels) > 0 {
 				s.NumLabel = numLabels
-				for key, units := range numUnits {
-					if len(units) > 0 {
-						numUnits[key] = padStringArray(units, len(numLabels[key]))
+				if len(numUnits) > 0 {
+					for key, units := range numUnits {
+						if len(units) > 0 {
+							numUnits[key] = padStringArray(units, len(numLabels[key]))
+						}
 					}
+					s.NumUnit = numUnits
 				}
-				s.NumUnit = numUnits
 			}
 		}
+		s.labelX = nil

 		s.Location = locBuffer[:len(s.locationIDX)]
 		locBuffer = locBuffer[len(s.locationIDX):]
diff --git a/src/cmd/vendor/github.com/google/pprof/profile/filter.go b/src/cmd/vendor/github.com/google/pprof/profile/filter.go
index c794b93906..426c7eb2bb 100644
--- a/src/cmd/vendor/github.com/google/pprof/profile/filter.go
+++ b/src/cmd/vendor/github.com/google/pprof/profile/filter.go
@@ -167,6 +167,7 @@ func (p *Profile) FilterTagsByName(show, hide *regexp.Regexp) (sm, hm bool) {
 		for lab := range s.NumLabel {
 			if matchRemove(lab) {
 				delete(s.NumLabel, lab)
+				delete(s.NumUnit, lab)
 			}
 		}
 	}
diff --git a/src/cmd/vendor/github.com/google/pprof/profile/merge.go b/src/cmd/vendor/github.com/google/pprof/profile/merge.go
index 8a51690be4..5e6c80bf0a 100644
--- a/src/cmd/vendor/github.com/google/pprof/profile/merge.go
+++ b/src/cmd/vendor/github.com/google/pprof/profile/merge.go
@@ -328,10 +328,10 @@ func (l *Location) key() locationKey {
 	lines := make([]string, len(l.Line)*3)
 	for i, line := range l.Line {
 		if line.Function != nil {
-			lines[i*2] = strconv.FormatUint(line.Function.ID, 16)
+			lines[i*3] = strconv.FormatUint(line.Function.ID, 16)
 		}
-		lines[i*2+1] = strconv.FormatInt(line.Line, 16)
-		lines[i*2+2] = strconv.FormatInt(line.Column, 16)
+		lines[i*3+1] = strconv.FormatInt(line.Line, 16)
+		lines[i*3+2] = strconv.FormatInt(line.Column, 16)
 	}
 	key.lines = strings.Join(lines, "|")
 	return key
diff --git a/src/cmd/vendor/github.com/google/pprof/profile/profile.go b/src/cmd/vendor/github.com/google/pprof/profile/profile.go
index 18df65a8df..7a713a04e7 100644
--- a/src/cmd/vendor/github.com/google/pprof/profile/profile.go
+++ b/src/cmd/vendor/github.com/google/pprof/profile/profile.go
@@ -344,9 +344,11 @@ func serialize(p *Profile) []byte {
 // Write writes the profile as a gzip-compressed marshaled protobuf.
 func (p *Profile) Write(w io.Writer) error {
 	zw := gzip.NewWriter(w)
-	defer zw.Close()
-	_, err := zw.Write(serialize(p))
-	return err
+	if _, err := zw.Write(serialize(p)); err != nil {
+		_ = zw.Close()
+		return err
+	}
+	return zw.Close()
 }

 // WriteUncompressed writes the profile as a marshaled protobuf.
@@ -807,10 +809,9 @@ func (p *Profile) ScaleN(ratios []float64) error {
 		keepSample := false
 		for i, v := range s.Value {
 			if ratios[i] != 1 {
-				val := int64(math.Round(float64(v) * ratios[i]))
-				s.Value[i] = val
-				keepSample = keepSample || val != 0
+				s.Value[i] = int64(math.Round(float64(v) * ratios[i]))
 			}
+			keepSample = keepSample || s.Value[i] != 0
 		}
 		if keepSample {
 			p.Sample[fillIdx] = s
diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt
index d95bce3953..4380b25e1c 100644
--- a/src/cmd/vendor/modules.txt
+++ b/src/cmd/vendor/modules.txt
@@ -1,7 +1,8 @@
-# github.com/google/pprof v0.0.0-20260507013755-92041b743c96
-## explicit; go 1.24.0
+# github.com/google/pprof v0.0.0-20261118010117-084b33a85f63
+## explicit; go 1.26.0
 github.com/google/pprof/driver
 github.com/google/pprof/internal/binutils
+github.com/google/pprof/internal/dotwriter
 github.com/google/pprof/internal/driver
 github.com/google/pprof/internal/elfexec
 github.com/google/pprof/internal/graph