Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. golang.org/x/text/encoding/unicode
  4. ›
  5. CVE-2020-14040

CVE-2020-14040: Loop with Unreachable Exit Condition ('Infinite Loop')

May 18, 2021

The x/text package before 0.3.3 for Go has a vulnerability in encoding/unicode that could lead to the UTF-16 decoder entering an infinite loop, causing the program to crash or run out of memory. An attacker could provide a single byte to a UTF16 decoder instantiated with UseBOM or ExpectBOM to trigger an infinite loop if the String function on the Decoder is called, or the Decoder is passed to golang.org/x/text/transform.String.

References

  • github.com/advisories/GHSA-5rcv-m4m3-hfh7
  • github.com/golang/go/issues/39491
  • github.com/golang/text/commit/23ae387dee1f90d29a23c0e87ee0b46038fbed0e
  • nvd.nist.gov/vuln/detail/CVE-2020-14040

Code Behaviors & Features

Detect and mitigate CVE-2020-14040 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 0.3.3

Fixed versions

  • 0.3.3

Solution

Upgrade to version 0.3.3 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Learn more about CVSS

Weakness

  • CWE-707: Improper Neutralization
  • CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')

Source file

go/golang.org/x/text/encoding/unicode/CVE-2020-14040.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:16:58 +0000.