1 Star 0 Fork 53

jiangpengjuj/vim

forked from src-openEuler/vim 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-CVE-2022-3037.patch 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
yueryoufeng 提交于 2022-09-05 15:33 . fix CVE-2022-3037
From 4f1b083be43f351bc107541e7b0c9655a5d2c0bb Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 29 Aug 2022 20:45:16 +0100
Subject: [PATCH] patch 9.0.0322: crash when no errors and 'quickfixtextfunc'
is set
Problem: Crash when no errors and 'quickfixtextfunc' is set.
Solution: Do not handle errors if there aren't any.
---
src/quickfix.c | 2 +-
src/testdir/test_quickfix.vim | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/quickfix.c b/src/quickfix.c
index f6851ef..edf262c 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4743,7 +4743,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid)
}
// Check if there is anything to display
- if (qfl != NULL)
+ if (qfl != NULL && qfl->qf_start != NULL)
{
char_u dirname[MAXPATHL];
int invalid_val = FALSE;
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index cf803ca..27bed51 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -4090,6 +4090,22 @@ func Xgetlist_empty_tests(cchar)
endif
endfunc
+func Test_empty_list_quickfixtextfunc()
+ " This was crashing. Can only reproduce by running it in a separate Vim
+ " instance.
+ let lines =<< trim END
+ func s:Func(o)
+ cgetexpr '0'
+ endfunc
+ cope
+ let &quickfixtextfunc = 's:Func'
+ cgetfile [ex
+ END
+ call writefile(lines, 'Xquickfixtextfunc')
+ call RunVim([], [], '-e -s -S Xquickfixtextfunc -c qa')
+ call delete('Xquickfixtextfunc')
+endfunc
+
func Test_getqflist()
call Xgetlist_empty_tests('c')
call Xgetlist_empty_tests('l')
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jiangpengjuj/vim.git
git@gitee.com:jiangpengjuj/vim.git
jiangpengjuj
vim
vim
master

搜索帮助