From: Vijay Anusuri <vanusuri@mvista.com>
To: openembedded-core@lists.openembedded.org
Cc: Vijay Anusuri <vanusuri@mvista.com>
Subject: [OE-core][wrynose][patch 04/10] vim: Fix CVE-2026-57451
Date: Wed, 22 Jul 2026 18:03:30 +0530 [thread overview]
Message-ID: <20260722123336.587556-4-vanusuri@mvista.com> (raw)
In-Reply-To: <20260722123336.587556-1-vanusuri@mvista.com>
Pick patch per [1].
[1] https://nvd.nist.gov/vuln/detail/CVE-2026-57451
[2] https://github.com/vim/vim/security/advisories/GHSA-f36c-2qcp-7gpw
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
.../vim/files/CVE-2026-57451.patch | 177 ++++++++++++++++++
meta/recipes-support/vim/vim.inc | 1 +
2 files changed, 178 insertions(+)
create mode 100644 meta/recipes-support/vim/files/CVE-2026-57451.patch
diff --git a/meta/recipes-support/vim/files/CVE-2026-57451.patch b/meta/recipes-support/vim/files/CVE-2026-57451.patch
new file mode 100644
index 0000000000..22a0cfc03e
--- /dev/null
+++ b/meta/recipes-support/vim/files/CVE-2026-57451.patch
@@ -0,0 +1,177 @@
+From b2338ca90643e2f01ecb6547c1172716aaec4f79 Mon Sep 17 00:00:00 2001
+From: Yasuhiro Matsumoto <mattn.jp@gmail.com>
+Date: Wed, 17 Jun 2026 21:06:59 +0000
+Subject: [PATCH] patch 9.2.0670: [security]: Out-of-bounds read with text
+ properties
+
+Problem: [security]: Out-of-bounds read with text properties
+ (cipher-creator)
+Solution: Add out-of-bound checks (Yasuhiro Matsumoto)
+
+Github Security Advisory:
+https://github.com/vim/vim/security/advisories/GHSA-f36c-2qcp-7gpw
+
+Supported by AI
+
+Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
+Signed-off-by: Christian Brabandt <cb@256bit.org>
+
+Upstream-Status: Backport [https://github.com/vim/vim/commit/b2338ca90643e2f01ecb6547c1172716aaec4f79]
+CVE: CVE-2026-57451
+Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
+---
+ src/memline.c | 7 ++++
+ src/proto/textprop.pro | 1 +
+ src/testdir/test_textprop2.vim | 59 ++++++++++++++++++++++++++++++++++
+ src/textprop.c | 20 ++++++++++++
+ 4 files changed, 87 insertions(+)
+
+diff --git a/src/memline.c b/src/memline.c
+index c15946a6eb..07c7a07d38 100644
+--- a/src/memline.c
++++ b/src/memline.c
+@@ -3796,6 +3796,11 @@ adjust_text_props_for_delete(
+ uint16_t pc;
+
+ mch_memmove(&pc, text + textlen, PROP_COUNT_SIZE);
++ if (!text_prop_count_valid(pc, (size_t)(line_size - (long)textlen)))
++ {
++ internal_error("text property count too large");
++ return;
++ }
+ this_props_len = pc * (int)sizeof(textprop_T);
+ }
+
+@@ -4034,6 +4039,8 @@ theend:
+ mch_memmove(&pc, textprop_save, PROP_COUNT_SIZE);
+ props_data = textprop_save + PROP_COUNT_SIZE;
+ props_bytes = pc * (int)sizeof(textprop_T);
++ if (!text_prop_count_valid(pc, (size_t)textprop_len))
++ props_bytes = 0;
+
+ // Adjust text properties in the line above and below.
+ if (lnum > 1)
+diff --git a/src/proto/textprop.pro b/src/proto/textprop.pro
+index d3ecf6d14c..a01c2f3b2d 100644
+--- a/src/proto/textprop.pro
++++ b/src/proto/textprop.pro
+@@ -35,4 +35,5 @@ void clear_buf_prop_types(buf_T *buf);
+ int adjust_prop_columns(linenr_T lnum, colnr_T col, int bytes_added, int flags);
+ void adjust_props_for_split(linenr_T lnum_props, linenr_T lnum_top, int kept, int deleted, int at_eol);
+ void prepend_joined_props(unpacked_memline_T *um, linenr_T lnum, int last_line, long col, int removed);
++bool text_prop_count_valid(int prop_count, size_t propdata_len);
+ /* vim: set ft=c : */
+diff --git a/src/testdir/test_textprop2.vim b/src/testdir/test_textprop2.vim
+index 193a808415..48387d1c04 100644
+--- a/src/testdir/test_textprop2.vim
++++ b/src/testdir/test_textprop2.vim
+@@ -428,4 +428,63 @@ func Test_multiline_prop_delete_penultimate_line()
+ call s:CleanupPropTypes(['1', '2', '3'])
+ endfunc
+
++func s:ManipulateUndoBlob(name)
++ " Patch the saved old line in the undo file:
++ " 00 00 00 08 'QQQQQQQQ' -> 00 00 00 27 'AAAA' NUL count=0xFFFF <32x00>
++ " i.e. textlen 8 text-only -> 39-byte blob: text "AAAA", NUL, prop_count
++ " 0xFFFF, one zeroed textprop_T(32). propdata_len becomes 34, count 65535.
++ let blob = readfile(a:name, 'B')
++ let marker = 0z000000085151515151515151
++ let repl = 0z000000274141414100FFFF + repeat(0z00, 32)
++ let mlen = len(marker)
++ let idx = -1
++ let i = 0
++ while i <= len(blob) - mlen
++ if blob[i : i + mlen - 1] ==# marker
++ let idx = i
++ break
++ endif
++ let i += 1
++ endwhile
++ call assert_true(idx >= 0, 'saved-line marker not found in undo file')
++
++ let head = idx > 0 ? blob[0 : idx - 1] : 0z
++ call writefile(head + repl + blob[idx + mlen :], a:name)
++
++ exe "rundo" a:name
++endfunc
++
++" A crafted undo file can restore a line whose declared text-property count is
++" far larger than the data, making get_text_props() / consumers read past the
++" line buffer. Restore such a line and force a consumer; reaching the asserts
++" (no ASan abort / crash) means the count is bounded.
++func Test_textprop_undo_bad_prop_count()
++ CheckFeature persistent_undo
++
++ new
++ call setline(1, ['QQQQQQQQ', 'DECOYLINE'])
++ let &ul = &ul
++ call setline(1, 'BBBB') " undo step saves old line 1 = "QQQQQQQQ"
++ wundo Xtpundo
++ call s:ManipulateUndoBlob('Xtpundo')
++
++ undo
++
++ " Safety: prove the malicious line was actually restored before the consumer
++ " runs, so the test can't pass vacuously if the patch missed.
++ call assert_equal('AAAA', getline(1))
++
++ " Adding a property anywhere sets b_has_textprop, so get_text_props() will
++ " actually inspect line 1 instead of returning early.
++ call prop_type_add('Xtp', {})
++ call prop_add(2, 1, {'type': 'Xtp', 'length': 1})
++
++ " this caused OOB read, now it triggers internal error
++ call assert_fails('call prop_list(1)', ['E340:', 'corrupted'])
++
++ call prop_type_delete('Xtp')
++ bwipe!
++ call delete('Xtpundo')
++endfunc
++
+ " vim: shiftwidth=2 sts=2 expandtab
+diff --git a/src/textprop.c b/src/textprop.c
+index 33165a8e43..931fb78d25 100644
+--- a/src/textprop.c
++++ b/src/textprop.c
+@@ -109,6 +109,12 @@ um_goto_line(unpacked_memline_T *um, linenr_T lnum, int extra_props)
+ char_u *props_start;
+
+ mch_memmove(&prop_count, count_ptr, PROP_COUNT_SIZE);
++ if (!text_prop_count_valid(prop_count, propdata_len))
++ {
++ iemsg(e_text_property_info_corrupted);
++ um->buf = NULL;
++ return false;
++ }
+ proplen = (int)prop_count;
+ props_start = count_ptr + PROP_COUNT_SIZE;
+
+@@ -1235,6 +1241,11 @@ get_text_props(buf_T *buf, linenr_T lnum, char_u **props, int will_change)
+ return 0;
+ }
+ mch_memmove(&prop_count, text + textlen, PROP_COUNT_SIZE);
++ if (!text_prop_count_valid(prop_count, propdata_len))
++ {
++ iemsg(e_text_property_info_corrupted);
++ return 0;
++ }
+ *props = text + textlen + PROP_COUNT_SIZE;
+ return (int)prop_count;
+ }
+@@ -3219,4 +3230,13 @@ prepend_joined_props(
+ um_abort(&r_um);
+ }
+
++ bool
++text_prop_count_valid(int prop_count, size_t propdata_len)
++{
++ if (propdata_len < PROP_COUNT_SIZE)
++ return false;
++ return (size_t)prop_count * sizeof(textprop_T)
++ <= propdata_len - PROP_COUNT_SIZE;
++}
++
+ #endif // FEAT_PROP_POPUP
+--
+2.43.0
+
diff --git a/meta/recipes-support/vim/vim.inc b/meta/recipes-support/vim/vim.inc
index ecdf7cb5b9..b9acb4665a 100644
--- a/meta/recipes-support/vim/vim.inc
+++ b/meta/recipes-support/vim/vim.inc
@@ -26,6 +26,7 @@ SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https;tag=v${PV}
file://CVE-2026-55693.patch \
file://CVE-2026-55895.patch \
file://CVE-2026-57453.patch \
+ file://CVE-2026-57451.patch \
"
PV .= ".0340"
--
2.43.0
next prev parent reply other threads:[~2026-07-22 12:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 12:33 [OE-core][wrynose][patch 01/10] vim: Fix CVE-2026-55693 Vijay Anusuri
2026-07-22 12:33 ` [OE-core][wrynose][patch 02/10] vim: Fix CVE-2026-55895 Vijay Anusuri
2026-07-22 12:33 ` [OE-core][wrynose][patch 03/10] vim: Fix CVE-2026-57453 Vijay Anusuri
2026-07-26 21:45 ` Yoann Congal
2026-07-22 12:33 ` Vijay Anusuri [this message]
2026-07-26 21:53 ` [OE-core][wrynose][patch 04/10] vim: Fix CVE-2026-57451 Yoann Congal
2026-07-22 12:33 ` [OE-core][wrynose][patch 05/10] vim: Fix CVE-2026-57454 Vijay Anusuri
2026-07-26 22:05 ` Yoann Congal
2026-07-22 12:33 ` [OE-core][wrynose][patch 06/10] vim: Fix CVE-2026-57455 Vijay Anusuri
2026-07-22 12:33 ` [OE-core][wrynose][patch 07/10] vim: Fix CVE-2026-57456 Vijay Anusuri
2026-07-22 12:33 ` [OE-core][wrynose][patch 08/10] vim: Fix CVE-2026-59856 Vijay Anusuri
2026-07-22 12:33 ` [OE-core][wrynose][patch 09/10] vim: Fix CVE-2026-59857 Vijay Anusuri
2026-07-22 12:33 ` [OE-core][wrynose][patch 10/10] vim: Fix CVE-2026-59858 Vijay Anusuri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260722123336.587556-4-vanusuri@mvista.com \
--to=vanusuri@mvista.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox