macvim-dev / macvim-dev/macvim
[Security] MacVim affected by CVE-2026-45130 — spell file heap buffer overflow (vim < 9.2.0450)
还没有人认领这个 Issue。
- 主要语言
- Vim Script
- 星标
- 7.9k
- 派生
- 691
- PR 合并指标
- 30 天内没有已合并 PR
描述
[Security] MacVim affected by CVE-2026-45130 — spell file heap buffer overflow (vim < 9.2.0450)
Summary
MacVim bundles the vim source at version 9.2 (patches 1-332 in the current build), which is
below the patched version 9.2.0450 that fixes CVE-2026-45130.
Vulnerability Details
- Upstream CVE: CVE-2026-45130
- Inherited from:
vim/vim - Affected code:
src/spellfile.c, functionread_compound() - Vulnerability type: CWE-122 — Heap-Based Buffer Overflow
- Fixed in: vim 9.2.0450 (commit
92993329178cb1f72d700fff45ca86e1c2d369f8)
Root Cause
In read_compound() in src/spellfile.c, the buffer size for the compound pattern is
computed as:
int c;
int todo = len; // len is the 4-byte section length from the .spl file
c = todo * 2 + 7;
if (enc_utf8)
c += todo * 2; // total: todo * 4 + 7
pat = alloc(c);
When enc_utf8 is active, todo * 4 + 7 is computed using signed 32-bit arithmetic.
For certain values of len (e.g., 0x40000002), the multiplication overflows the signed
32-bit integer, producing a small positive c. The subsequent alloc(c) returns an
undersized buffer. The loop that follows then writes up to todo * 4 bytes into this
tiny buffer, causing a heap-based buffer overflow.
The fix (commit 92993329) changes the computation to use size_t arithmetic:
size_t patsize = (size_t)todo * 2 + 7;
patsize += (size_t)todo * 2;
Affected MacVim Code
MacVim's src/spellfile.c (merged from vim/vim) contains the vulnerable code:
// src/spellfile.c around line 1278 (macvim r183)
c = todo * 2 + 7;
if (enc_utf8)
c += todo * 2;
pat = alloc(c);
Affected MacVim Version
MacVim r183 (vim 9.2 patches 1-332) — current HEAD as of 2026-05-18.
The fix commit 92993329178cb1f72d700fff45ca86e1c2d369f8 from vim/vim is not present
in the macvim-dev/macvim repository:
git log --all --oneline | grep 92993329 # returns no output
Suggested Fix
Merge or cherry-pick vim/vim patches up to at least 9.2.0450:
References
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 src/spellfile.c 中的 read_compound() 开始,将当前的分配逻辑与上游 Vim 提交 92993329178cb1f72d700fff45ca86e1c2d369f8 进行比较。确认 Vim 9.2.0450 的修复已集成到 MacVim 中,并且易受攻击的有符号算术已不再存在。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, vim
- 领域
- security
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 64/100