Use of Uninitialized Variable in vim/vim
Description
vim before 8.2.3582 uses an uninitialized variable in the spell suggestion code path, leading to undefined behavior.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
vim before 8.2.3582 uses an uninitialized variable in the spell suggestion code path, leading to undefined behavior.
Vulnerability
CVE-2021-3928 is a use-of-uninitialized-variable vulnerability in vim prior to patch 8.2.3582 [2]. The bug resides in the suggest_trie_walk() function inside src/spell.c. When generating spell suggestions, the code checks whether a character is a word character via spell_iswordp(p, curwin), but before that check it does not verify that *preword is not NUL. This means if preword is an empty string, the pointer p is moved backward via MB_PTR_BACK(fword, p) into uninitialized memory, and the subsequent spell_iswordp() call reads that uninitialized area [2]. The affected versions include all vim releases before the fix commit 15d9890eee53afc61eb0a03b878a19cb5672f732 was incorporated [2].
Exploitation
To trigger the vulnerability, an attacker must convince a victim to open a specially crafted text file in vim and then invoke the spell suggestion feature (e.g., by typing z= on a misspelled word) [1]. No authentication or elevated privileges are required on the victim's side, but the attack requires user interaction. The fix commit includes a test case Test_spell_single_word() that reproduces the crash by entering specific characters and performing spell operations [2].
Impact
Successful exploitation results in reading uninitialized memory, which can cause undefined behavior — typically a crash (denial of service) but potentially information disclosure if the uninitialized data contains sensitive values [1]. The impact is limited by the need for user interaction and the specific spell suggestion code path.
Mitigation
The vulnerability was fixed in vim patch 8.2.3582, released on the same day the commit was made (2021-11-05) [2]. Users should upgrade to vim version 8.2.3582 or later. Distributions, such as Fedora, have released updated packages; administrators should apply those updates [3][4]. No workaround exists other than avoiding use of the spell suggestion feature on untrusted input.
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
42- osv-coords40 versionspkg:rpm/opensuse/vim&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/vim&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/vim&distro=openSUSE%20Leap%20Micro%205.2pkg:rpm/opensuse/vim&distro=openSUSE%20Leap%20Micro%205.3pkg:rpm/suse/vim&distro=SUSE%20Enterprise%20Storage%206pkg:rpm/suse/vim&distro=SUSE%20Enterprise%20Storage%207pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-ESPOSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP2-ESPOSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP2-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-ESPOSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Micro%205.0pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Micro%205.1pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Micro%205.2pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Micro%205.3pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP3pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP4pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Desktop%20Applications%2015%20SP3pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Desktop%20Applications%2015%20SP4pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Real%20Time%2015%20SP2pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP2-BCLpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP3-BCLpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP4-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP5pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-BCLpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP2-BCLpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP2-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2015-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP4pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP5pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP1pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP2pkg:rpm/suse/vim&distro=SUSE%20Manager%20Proxy%204.1pkg:rpm/suse/vim&distro=SUSE%20Manager%20Retail%20Branch%20Server%204.1pkg:rpm/suse/vim&distro=SUSE%20Manager%20Server%204.1pkg:rpm/suse/vim&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/vim&distro=SUSE%20OpenStack%20Cloud%20Crowbar%209
< 8.2.5038-150000.5.21.1+ 39 more
- (no CPE)range: < 8.2.5038-150000.5.21.1
- (no CPE)range: < 8.2.5038-150000.5.21.1
- (no CPE)range: < 9.0.0814-150000.5.28.1
- (no CPE)range: < 9.0.0814-150000.5.28.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 9.0.0814-150000.5.28.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.2.5038-150000.5.21.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.2.5038-150000.5.21.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 9.0.0814-17.9.1
- (no CPE)range: < 9.0.0814-17.9.1
- (no CPE)range: < 9.0.0814-17.9.1
- (no CPE)range: < 9.0.0814-17.9.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 9.0.0814-17.9.1
- (no CPE)range: < 9.0.0814-17.9.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 8.0.1568-5.17.1
- (no CPE)range: < 9.0.0814-17.9.1
- (no CPE)range: < 9.0.0814-17.9.1
Patches
0No patches discovered yet.
Vulnerability mechanics
Root cause
"Missing null check on `preword` before calling `MB_PTR_BACK` leads to reading uninitialized memory in `suggest_trie_walk`."
Attack vector
An attacker can trigger this by opening a file containing a single word (e.g., `ßÂ`) and invoking the spell suggestion feature (`z=`). When `preword` is empty, the uninitialized memory read occurs during `MB_PTR_BACK(preword, p)`, leading to undefined behavior. The attack requires the user to have spell checking enabled and to interact with the suggestion prompt. [ref_id=1]
Affected code
The vulnerability is in the `suggest_trie_walk` function in Vim's spell-checking code. The patch adds a check for `*preword != NUL` before calling `MB_PTR_BACK` on `preword`, preventing an out-of-bounds read when `preword` is empty.
What the fix does
The patch adds a guard `&& *preword != NUL` to the existing `spell_iswordp` check. This ensures that `MB_PTR_BACK(preword, p)` is only called when `preword` actually contains a character, preventing the read of uninitialized memory. The accompanying test `Test_spell_single_word()` reproduces the crash scenario with a single-word buffer. [ref_id=1]
Preconditions
- configSpell checking must be enabled in the Vim session.
- inputThe buffer must contain a single word (no preceding word) so that `preword` is empty.
- inputThe user must invoke the spell suggestion command (`z=`).
Generated on May 29, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
9- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BCQWPEY2AEYBELCMJYHYWYCD3PZVD2H7/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FNXY7T5OORA7UJIMGSJBGHFMU6UZWS6P/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/PGW56Z6IN4UVM3E5RXXF4G7LGGTRBI5C/mitrevendor-advisory
- security.gentoo.org/glsa/202208-32mitrevendor-advisory
- www.openwall.com/lists/oss-security/2022/01/15/1mitremailing-list
- lists.debian.org/debian-lts-announce/2022/03/msg00018.htmlmitremailing-list
- lists.debian.org/debian-lts-announce/2022/11/msg00009.htmlmitremailing-list
- github.com/vim/vim/commit/15d9890eee53afc61eb0a03b878a19cb5672f732mitre
- huntr.dev/bounties/29c3ebd2-d601-481c-bf96-76975369d0cdmitre
News mentions
0No linked articles in our index yet.