CVE-2021-3826
Description
Null pointer dereference in libiberty's D demangler via crafted mangled symbol leads to denial of service.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Null pointer dereference in libiberty's D demangler via crafted mangled symbol leads to denial of service.
Vulnerability
The dlang_lname function in libiberty/d-demangle.c contains a null pointer dereference vulnerability when processing a crafted mangled symbol. Specifically, in the dlang_type function, a null pointer check is missing before dereferencing a pointer that could be null, leading to a segmentation fault. This issue affects libiberty as shipped with GNU Compiler Collection (GCC) prior to the patch applied in September 2021 [1].
Exploitation
An attacker can trigger the vulnerability by providing a specially crafted mangled D symbol to an application that uses libiberty's demangling routines. No authentication or special privileges are required; the attacker only needs the ability to supply the malicious input to the demangler. The crafted symbol causes a null pointer dereference in the dlang_type function when the mangled string contains a back reference marker ('Q') without a valid preceding type [1].
Impact
Successful exploitation causes a segmentation fault, resulting in a denial of service (DoS) crash of the affected process. The vulnerability does not allow for arbitrary code execution or privilege escalation; its impact is limited to availability [1].
Mitigation
The fix for this vulnerability is provided in a patch posted to the GCC mailing list on September 22, 2021 [1]. The patch adds a null check before dereferencing the pointer in dlang_type. Users should apply the patch or update to a version of GCC that includes the fix. No workaround other than avoiding untrusted input to the demangler is known.
AI Insight generated on May 27, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
84- osv-coords82 versionspkg:rpm/almalinux/gdbpkg:rpm/almalinux/gdb-docpkg:rpm/almalinux/gdb-gdbserverpkg:rpm/almalinux/gdb-headlesspkg:rpm/almalinux/gdb-minimalpkg:rpm/opensuse/binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/binutils&distro=openSUSE%20Tumbleweedpkg:rpm/opensuse/cross-aarch64-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-aarch64-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-arm-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-arm-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-avr-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-avr-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-epiphany-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-epiphany-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-hppa64-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-hppa64-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-hppa-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-hppa-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-i386-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-i386-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-ia64-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-ia64-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-m68k-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-m68k-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-mips-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-mips-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-ppc64-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-ppc64-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-ppc64le-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-ppc64le-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-ppc-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-ppc-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-riscv64-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-riscv64-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-rx-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-rx-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-s390-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-s390-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-s390x-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-s390x-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-sparc64-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-sparc64-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-sparc-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-sparc-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-spu-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-spu-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/cross-x86_64-binutils&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/cross-x86_64-binutils&distro=openSUSE%20Leap%2015.4pkg:rpm/suse/binutils&distro=SUSE%20Enterprise%20Storage%206pkg:rpm/suse/binutils&distro=SUSE%20Enterprise%20Storage%207pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-ESPOSpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-LTSSpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP2-ESPOSpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP2-LTSSpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP3pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP4pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP3pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP4pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Package%20Hub%2015%20SP3pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Package%20Hub%2015%20SP4pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP2-BCLpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP3-BCLpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP4-LTSSpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP5pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-BCLpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-LTSSpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP2-BCLpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP2-LTSSpkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP4pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP5pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP1pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP2pkg:rpm/suse/binutils&distro=SUSE%20Linux%20Enterprise%20Software%20Development%20Kit%2012%20SP5pkg:rpm/suse/binutils&distro=SUSE%20Manager%20Proxy%204.1pkg:rpm/suse/binutils&distro=SUSE%20Manager%20Retail%20Branch%20Server%204.1pkg:rpm/suse/binutils&distro=SUSE%20Manager%20Server%204.1pkg:rpm/suse/binutils&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/binutils&distro=SUSE%20OpenStack%20Cloud%20Crowbar%209pkg:rpm/suse/cross-ppc-binutils&distro=SUSE%20Linux%20Enterprise%20Software%20Development%20Kit%2012%20SP5pkg:rpm/suse/cross-spu-binutils&distro=SUSE%20Linux%20Enterprise%20Software%20Development%20Kit%2012%20SP5
< 10.2-11.el9+ 81 more
- (no CPE)range: < 10.2-11.el9
- (no CPE)range: < 10.2-11.el9
- (no CPE)range: < 10.2-11.el9
- (no CPE)range: < 10.2-11.el9
- (no CPE)range: < 10.2-11.el9
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-2.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-150100.7.40.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-9.50.1
- (no CPE)range: < 2.39-9.50.1
Patches
0No patches discovered yet.
Vulnerability mechanics
Root cause
"Missing null pointer check before dereferencing the `mangled` pointer in `dlang_type` allows a crafted mangled symbol to cause a null pointer dereference."
Attack vector
An attacker can craft a malformed D language mangled symbol (e.g., `_D01_D`) that causes the `mangled` pointer to become NULL inside `dlang_type`. When the demangler processes this symbol, it dereferences the null pointer, leading to a segmentation fault. This can be triggered remotely if an application that uses libiberty's demangling routines processes untrusted input, resulting in a denial of service [ref_id=1].
Affected code
The vulnerability is in the `dlang_type` function in `libiberty/d-demangle.c`. When processing a crafted mangled symbol, the function dereferences a null pointer because the `mangled` pointer is not checked for NULL before being used in the `*mangled == 'Q'` comparison. The patch adds a `mangled &&` guard before that check.
What the fix does
The patch adds a `mangled &&` guard before the `*mangled == 'Q'` check in `dlang_type` [ref_id=1]. This ensures the pointer is validated before dereferencing, preventing the null pointer dereference that caused the SIGSEGV. The test suite is also updated with a new test case (`_D01_D`) to verify the fix.
Preconditions
- inputThe attacker must supply a crafted D language mangled symbol (e.g., `_D01_D`) to a program that uses libiberty's demangling functions.
- networkNo authentication or special network position is required; the attack can be triggered over any channel where untrusted input reaches the demangler.
Generated on May 29, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
7- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/4MYLS3VR4OPL5ECRWOR4ZHMGXUSCJFZY/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6AKZ2DTS3ATVN5PANNVLKLE5OP4OF25Q/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7MTEHT3G6YKJ7F7MSGWYSI4UM3XBAYXZ/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/AXFC74WRZ2Q7F2TSUKPYNIL7ZPBWYI6L/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/H424YXGW7OKXS2NCAP35OP6Y4P4AW6VG/mitrevendor-advisory
- gcc.gnu.org/git/mitre
- gcc.gnu.org/pipermail/gcc-patches/2021-September/579987mitre
News mentions
0No linked articles in our index yet.