changeset 36057:b9f5056aacde v9.1.0701

patch 9.1.0701: crash with NFA regex engine when searching for composing chars Commit: https://github.com/vim/vim/commit/c3a02d78bd7a4622e85af348b24fb1388d160de1 Author: Christian Brabandt <cb@256bit.org> Date: Wed Aug 28 23:17:52 2024 +0200 patch 9.1.0701: crash with NFA regex engine when searching for composing chars Problem: crash with NFA regex engine when searching for composing chars (SuyueGuo) Solution: When there is no composing character, break out of the loop and check that out1 state is not null fixes: #15583 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Wed, 28 Aug 2024 23:30:02 +0200
parents 8519906fc6d4
children 1f0d379c20b7
files src/regexp_nfa.c src/testdir/crash/nullptr_regexp_nfa src/testdir/test_crash.vim src/version.c
diffstat 4 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -6525,7 +6525,8 @@ nfa_regmatch(
 			else
 			    result = FAIL;
 
-			if (t->state->out->out1->c == NFA_END_COMPOSING)
+			if (t->state->out->out1 != NULL
+				&& t->state->out->out1->c == NFA_END_COMPOSING)
 			{
 			    end = t->state->out->out1;
 			    ADD_STATE_IF_MATCH(end);
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..6b2edc62a36f64d27231ae5eb2b7959cbcbd4510
GIT binary patch
literal 429
zc%0MIOU-=29HYRM_rF-!!rab}t2i?!HLpZ5FTW^veGtn_ku%$XK!B?_zeu69NPz*U
zFeN6rw5UABGA1w8p*U5+p(Z+w%L>Ry%}dTt$;?Z)HA<>1N!2YaNz*knQ%F_NHB`_x
zH2lvM&k&Z%6=lekQ_R4Xq74HL|8*NC0qM+{mU;Olx{10asYSU-5)$$ZSj^?Z4uB?>
zDLhQ!bIwe&jE$*DE6vlgNXjhH%{SmmY-n{(is9xevy6&1&`lIe)Jl%gj;XOQ&;_YX
zG>?m^iBWa-aCP=}_V*3&5A|~iat(O*PVn73#&_@D)j;(m#k>Q7yiC>F;*^w>)U@mv
zpeewB0tZEAo^}j|p{Wo<GjdXaGSOMZ`FV@9&MeT<|0j@Gl%B)K#|8@F#GL9XO!E!3
QL8e7ROv?r9H^>EI0M?n38vp<R
--- a/src/testdir/test_crash.vim
+++ b/src/testdir/test_crash.vim
@@ -228,6 +228,11 @@ func Test_crash1_3()
   call term_sendkeys(buf, args)
   call TermWait(buf, 50)
 
+  let file = 'crash/nullptr_regexp_nfa'
+  let cmn_args = "%s -u NONE -i NONE -n -X -m -n -e -s -S %s -c ':qa!'"
+  let args = printf(cmn_args, vim, file)
+  call term_sendkeys(buf, args)
+  call TermWait(buf, 50)
 
   " clean up
   exe buf .. "bw!"
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    701,
+/**/
     700,
 /**/
     699,