代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/vim 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 11977f917506d950b7e0cae558bd9189260b253b Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 21 Jan 2023 13:09:19 +0000
Subject: [PATCH] patch 9.0.1225: reading past the end of a line when
formatting text
Problem: Reading past the end of a line when formatting text.
Solution: Check for not going over the end of the line.
---
src/textformat.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/textformat.c b/src/textformat.c
index 6a93890bd2c4..7ebbc8849a45 100644
--- a/src/textformat.c
+++ b/src/textformat.c
@@ -540,6 +540,9 @@ same_leader(
if (leader1_len == 0)
return (leader2_len == 0);
+ char_u *lnum_line = NULL;
+ int line_len = 0;
+
// If first leader has 'f' flag, the lines can be joined only if the
// second line does not have a leader.
// If first leader has 'e' flag, the lines can never be joined.
@@ -555,7 +558,12 @@ same_leader(
return FALSE;
if (*p == COM_START)
{
- if (*(ml_get(lnum) + leader1_len) == NUL)
+ if (lnum_line == NULL)
+ {
+ lnum_line = ml_get(lnum);
+ line_len = (int)STRLEN(lnum_line);
+ }
+ if (line_len <= leader1_len)
return FALSE;
if (leader2_flags == NULL || leader2_len == 0)
return FALSE;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。