1 Star 0 Fork 58

zhangkea/vim

forked from src-openEuler/vim 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-CVE-2022-3520.patch 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
wjiang 提交于 2022-12-06 14:37 +08:00 . fix CVE-2022-3491 CVE-2022-3520 CVE-2022-3591
From 36343ae0fb7247e060abfd35fb8e4337b33abb4b Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 15 Oct 2022 19:04:05 +0100
Subject: [PATCH] patch 9.0.0765: with a Visual block a put command column may
go negative
Problem: With a Visual block a put command column may go negative.
Solution: Check that the column does not become negative.
---
src/register.c | 2 ++
src/testdir/test_visual.vim | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/src/register.c b/src/register.c
index 30e2001..41089a0 100644
--- a/src/register.c
+++ b/src/register.c
@@ -1945,6 +1945,8 @@ do_put(
// adjust '] mark
curbuf->b_op_end.lnum = curwin->w_cursor.lnum - 1;
curbuf->b_op_end.col = bd.textcol + totlen - 1;
+ if (curbuf->b_op_end.col < 0)
+ curbuf->b_op_end.col = 0;
curbuf->b_op_end.coladd = 0;
if (flags & PUT_CURSEND)
{
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index e965266..956a3d7 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -483,6 +483,18 @@ func Test_visual_block_put()
bw!
endfunc
+func Test_visual_block_put_invalid()
+ enew!
+ behave mswin
+ norm yy
+ norm v)Ps/^/
+ " this was causing the column to become negative
+ silent norm ggv)P
+
+ bwipe!
+ behave xterm
+endfunc
+
" Visual modes (v V CTRL-V) followed by an operator; count; repeating
func Test_visual_mode_op()
new
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangkea/vim.git
git@gitee.com:zhangkea/vim.git
zhangkea
vim
vim
master

搜索帮助