Skip to content
Heist/ feed
Back to feed
UnratedFix available

Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net

Type: advisorySources: OSV

When coalescing adjacent text nodes in addText and fosterParent, appending to an existing TextNode's Data via string concatenation (n.Data += text) reallocated and copied the accumulated string on every token. Inputs containing many short text runs separated by ignored end tags (such as "a") caused O(n^2) allocations and byte copies. Accumulate coalesced text in per-node byte slices during parsing and materialize Data strings once at the end of parse.

Products
golang.org/x/net
Affected versions
Not specified
Fixed versions
0.62.0
CVEs
CVE-2026-78661
Confirmed fixed CVEs
Not specified
Updated in this feed
2 Nov 2026, 14:56 UTC · Revision 1

Source evidence

Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net

core-osv · Original source

Published 27 Oct 2026, 21:16 UTC

When coalescing adjacent text nodes in addText and fosterParent, appending to an existing TextNode's Data via string concatenation (n.Data += text) reallocated and copied the accumulated string on every token. Inputs containing many short text runs separated by ignored end tags (such as "a") caused O(n^2) allocations and byte copies. Accumulate coalesced text in per-node byte slices during parsing and materialize Data strings once at the end of parse.

osv:GO-2026-6860

golang.org/x/net

Fixed versions: 0.62.0

Complete source record
{
  "id": "7a02ac81ceeb15c65aeb922192e7c3b8c6bbcd7f36fc8910f228f7bbe54a4616",
  "url": "https://osv.dev/vulnerability/GO-2026-6860",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net",
    "summary": "When coalescing adjacent text nodes in addText and fosterParent, appending to an existing TextNode's Data via string concatenation (n.Data += text) reallocated and copied the accumulated string on every token. Inputs containing many short text runs separated by ignored end tags (such as \"a\") caused O(n^2) allocations and byte copies. Accumulate coalesced text in per-node byte slices during parsing and materialize Data strings once at the end of parse.",
    "evidence": "osv:GO-2026-6860",
    "products": [
      {
        "name": {
          "value": "golang.org/x/net",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "0.62.0",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "GO-2026-6860",
      "aliases": [
        "CVE-2026-78661",
        "GO-2026-6860"
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "0.62.0"
                }
              ]
            }
          ],
          "package": {
            "name": "golang.org/x/net",
            "purl": "pkg:golang/golang.org/x/net",
            "ecosystem": "Go"
          },
          "database_specific": {
            "source": "https://vuln.go.dev/ID/GO-2026-6860.json"
          },
          "ecosystem_specific": {
            "imports": [
              {
                "path": "golang.org/x/net/html",
                "symbols": [
                  "Parse",
                  "ParseFragment",
                  "ParseFragmentWithOptions",
                  "ParseWithOptions",
                  "parser.addText",
                  "parser.fosterParent",
                  "parser.parse"
                ]
              }
            ]
          }
        }
      ],
      "modified": "2026-10-27T21:30:04.890809062Z",
      "provider": "osv",
      "references": [
        "https://go.dev/cl/849365",
        "https://go.dev/issue/82224",
        "https://groups.google.com/g/golang-announce/c/sqrs2vTx_Xs"
      ],
      "provider_metadata": {
        "url": "https://pkg.go.dev/vuln/GO-2026-6860",
        "review_status": "REVIEWED"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-78661",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 486110,
  "published_at": "2026-10-27T21:16:18+00:00"
}