Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net
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/html
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2026-78661
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 31 Oct 2026, 16:31 UTC · Revision 1
Source evidence
Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net
core-cve · Original sourcePublished 27 Oct 2026, 21:38 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.
cve:CVE-2026-78661
golang.org/x/net/html
Fixed versions: Not specified
Complete source record
{
"id": "6e132860a1a3db03ca795779863bf29449c500ba7007fe12b87202ea847f45ce",
"url": "https://www.cve.org/CVERecord?id=CVE-2026-78661",
"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": "cve:CVE-2026-78661",
"products": [
{
"name": {
"value": "golang.org/x/net/html",
"evidence": "/containers/cna/affected/0/product"
},
"prerequisites": [],
"fixed_versions": [],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "CVE-2026-78661",
"aliases": [
"CVE-2026-78661"
],
"metrics": [],
"affected": [
{
"vendor": "golang.org/x/net",
"product": "golang.org/x/net/html",
"versions": [
{
"status": "affected",
"version": "0",
"lessThan": "0.62.0",
"versionType": "semver"
}
],
"packageName": "golang.org/x/net/html",
"collectionURL": "https://pkg.go.dev",
"defaultStatus": "unaffected",
"programRoutines": [
{
"name": "parser.addText"
},
{
"name": "parser.fosterParent"
},
{
"name": "parser.parse"
},
{
"name": "Parse"
},
{
"name": "ParseFragment"
},
{
"name": "ParseFragmentWithOptions"
},
{
"name": "ParseWithOptions"
}
]
}
],
"modified": "2026-10-27T21:38:56.517Z",
"provider": "cve",
"references": [
"https://go.dev/cl/849365",
"https://go.dev/issue/82224",
"https://groups.google.com/g/golang-announce/c/sqrs2vTx_Xs",
"https://pkg.go.dev/vuln/GO-2026-6860"
],
"provider_metadata": {
"cna": {
"orgId": "1bb62c36-49e3-4200-9d77-64a1400537cc",
"shortName": "Go",
"dateUpdated": "2026-10-27T21:38:56.517Z"
}
}
},
"related_cves": [
{
"value": "CVE-2026-78661",
"evidence": "/cveMetadata/cveId"
}
],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-cve",
"document_id": 400613,
"published_at": "2026-10-27T21:38:56.517+00:00"
}