{"id":"CVE-2026-78661","state":"PUBLISHED","title":"Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net","description":"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.","publishedAt":"2026-10-27T21:38:56.517Z","updatedAt":"2026-10-27T21:38:56.517Z","severity":null,"assigner":"Go","products":["golang.org/x/net golang.org/x/net/html"],"affected":[{"vendor":"golang.org/x/net","product":"golang.org/x/net/html","packageName":"golang.org/x/net/html","defaultStatus":"unaffected","versions":[{"version":"0","status":"affected","lessThan":"0.62.0","versionType":"semver"}],"collectionURL":"https://pkg.go.dev","programRoutines":[{"name":"parser.addText"},{"name":"parser.fosterParent"},{"name":"parser.parse"},{"name":"Parse"},{"name":"ParseFragment"},{"name":"ParseFragmentWithOptions"},{"name":"ParseWithOptions"}]}],"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"],"weaknesses":[],"ingestedAt":"2026-10-29T20:13:07.220Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/78xxx/CVE-2026-78661.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-78661","state":"PUBLISHED","datePublished":"2026-10-27T21:38:56.517Z","dateUpdated":"2026-10-27T21:38:56.517Z","assignerShortName":"Go","assignerOrgId":"1bb62c36-49e3-4200-9d77-64a1400537cc","dateReserved":"2026-08-24T23:36:15.738Z"},"containers":{"cna":{"title":"Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net","descriptions":[{"lang":"en","value":"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":[{"vendor":"golang.org/x/net","product":"golang.org/x/net/html","packageName":"golang.org/x/net/html","defaultStatus":"unaffected","versions":[{"version":"0","status":"affected","lessThan":"0.62.0","versionType":"semver"}],"collectionURL":"https://pkg.go.dev","programRoutines":[{"name":"parser.addText"},{"name":"parser.fosterParent"},{"name":"parser.parse"},{"name":"Parse"},{"name":"ParseFragment"},{"name":"ParseFragmentWithOptions"},{"name":"ParseWithOptions"}]}],"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"}],"problemTypes":[{"descriptions":[{"lang":"en","description":"CWE-407: Inefficient Algorithmic Complexity"}]}],"providerMetadata":{"shortName":"Go","orgId":"1bb62c36-49e3-4200-9d77-64a1400537cc","dateUpdated":"2026-10-27T21:38:56.517Z"},"credits":[{"lang":"en","value":"Markus Magnuson"}]}}}}