macvim-dev / macvim-dev/macvim

[Security] MacVim affected by CVE-2026-45130 — spell file heap buffer overflow (vim < 9.2.0450)

オープン
#1,649 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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, function read_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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

src/spellfile.c の read_compound() から始め、現在の割り当てロジックを upstream Vim のコミット 92993329178cb1f72d700fff45ca86e1c2d369f8 と比較してください。Vim 9.2.0450 の修正が MacVim に統合されていることと、脆弱な符号付き算術がもはや存在しないことを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, vim
領域
security
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
64/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。