diff src/regexp_bt.c @ 27829:0138ce89703b v8.2.4440

patch 8.2.4440: crash with specific regexp pattern and string Commit: https://github.com/vim/vim/commit/6456fae9ba8e72c74b2c0c499eaf09974604ff30 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 22 13:37:31 2022 +0000 patch 8.2.4440: crash with specific regexp pattern and string Problem: Crash with specific regexp pattern and string. Solution: Stop at the start of the string.
author Bram Moolenaar <Bram@vim.org>
date Tue, 22 Feb 2022 14:45:03 +0100
parents fb4c30606b4a
children 692f6a861c47
line wrap: on
line diff
--- a/src/regexp_bt.c
+++ b/src/regexp_bt.c
@@ -4615,6 +4615,11 @@ regmatch(
 			    if (rex.input == rex.line)
 			    {
 				// backup to last char of previous line
+				if (rex.lnum == 0)
+				{
+				    status = RA_NOMATCH;
+				    break;
+				}
 				--rex.lnum;
 				rex.line = reg_getline(rex.lnum);
 				// Just in case regrepeat() didn't count