vim/backport-CVE-2022-2125.patch

49 lines
1.2 KiB
Diff
Raw Normal View History

From 0e8e938d497260dd57be67b4966cb27a5f72376f Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 18 Jun 2022 12:51:11 +0100
Subject: [PATCH] patch 8.2.5122: lisp indenting my run over the end of the
line
Problem: Lisp indenting my run over the end of the line.
Solution: Check for NUL earlier.
---
src/indent.c | 2 ++
src/testdir/test_indent.vim | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/src/indent.c b/src/indent.c
index 4677d29..2d07e2e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1920,6 +1920,8 @@ get_lisp_indent(void)
}
}
}
+ if (*that == NUL)
+ break;
}
if (*that == '(' || *that == '[')
++parencount;
diff --git a/src/testdir/test_indent.vim b/src/testdir/test_indent.vim
index 91e801a..f3b8b6b 100644
--- a/src/testdir/test_indent.vim
+++ b/src/testdir/test_indent.vim
@@ -98,4 +98,14 @@ func Test_copyindent()
close!
endfunc
+func Test_lisp_indent_quoted()
+ " This was going past the end of the line
+ new
+ setlocal lisp autoindent
+ call setline(1, ['"[', '='])
+ normal Gvk=
+
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
--
1.8.3.1