---
id: CVE-2026-78661
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 shor…
severity: none
cwe:
  - CWE-407
vendor: golang.org/x/net
product: golang.org/x/net/html
affected:
  - golang.org/x/net/html < 0.62.0
published: '2026-10-27'
updated: '2026-10-27'
sourceUpdated: '2026-10-27T21:38:56.517Z'
source: CVEORG
sourceUrl: 'https://www.cve.org/CVERecord?id=CVE-2026-78661'
references:
  - url: 'https://go.dev/cl/849365'
  - url: 'https://go.dev/issue/82224'
  - url: 'https://groups.google.com/g/golang-announce/c/sqrs2vTx_Xs'
  - url: 'https://pkg.go.dev/vuln/GO-2026-6860'
tags:
  - cve.org
ingestedAt: '2026-10-27T21:58:08.745Z'
---

## Overview

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</x>") 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.

## Affected

- `golang.org/x/net/html < 0.62.0`

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
