vim/0001-patch-9.2.0846-security-heap-buffer-overflow-in-set_.patch
RHEL Packaging Agent 83ebe82162 Fix CVE-2026-73072: heap buffer overflow in set_sofo()
Backport fix for CVE-2026-73072 (heap buffer overflow in
set_sofo()) from upstream commit 05c41c9223 (patch 9.2.0846).

A crafted spell file with an empty SN_SAL section before an
SN_SOFO section could cause set_sofo() to under-count colliding
multi-byte characters, allocate an undersized list, and write
past its end. The fix resets sl_sal_first[] before the counting
loop. The test was dropped.

CVE: CVE-2026-73072
Upstream patches:
 - 05c41c9223.patch
Resolves: RHEL-242481

This commit was backported by Ymir, a Red Hat Enterprise Linux software maintenance AI agent.

Assisted-by: Ymir
2026-08-19 17:12:08 +02:00

42 lines
1.6 KiB
Diff

From 9004782afe9874358b727c01f71013a3a42985d3 Mon Sep 17 00:00:00 2001
From: RHEL Packaging Agent <redhat-ymir-agent@redhat.com>
Date: Mon, 17 Aug 2026 08:12:54 +0000
Subject: [PATCH] patch 9.2.0846: [security]: heap buffer overflow in
set_sofo()
Problem: [security]: heap buffer overflow in set_sofo()
(Yazan Balawneh)
Solution: Reset sl_sal_first (Yasuhiro Matsumoto).
A crafted spell file with an empty SN_SAL section before an SN_SOFO
section reaches set_sofo() with sl_sal_first[] already set to -1 by
set_sal_first(). The counting loop then under-counts colliding
multi-byte "from" characters, allocates an undersized list and writes
past its end.
Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-9jqx-hgpr-6v64
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
---
src/spellfile.c | 4 +++-
src/testdir/test_spellfile.vim | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/spellfile.c b/src/spellfile.c
index 50a9c6a..4ac9750 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -1424,7 +1424,9 @@ set_sofo(slang_T *lp, char_u *from, char_u *to)
gap->ga_len = 256;
/* First count the number of items for each list. Temporarily use
- * sl_sal_first[] for this. */
+ * sl_sal_first[] for this. Reset it first: a preceding SN_SAL section
+ * may have set the entries to -1 via set_sal_first(). */
+ vim_memset(lp->sl_sal_first, 0, sizeof(salfirst_T) * 256);
for (p = from, s = to; *p != NUL && *s != NUL; )
{
c = mb_cptr2char_adv(&p);