Skip to content

Commit c3a02d7

Browse files
committed
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>
1 parent 1c815b5 commit c3a02d7

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/regexp_nfa.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6525,7 +6525,8 @@ nfa_regmatch(
65256525
else
65266526
result = FAIL;
65276527

6528-
if (t->state->out->out1->c == NFA_END_COMPOSING)
6528+
if (t->state->out->out1 != NULL
6529+
&& t->state->out->out1->c == NFA_END_COMPOSING)
65296530
{
65306531
end = t->state->out->out1;
65316532
ADD_STATE_IF_MATCH(end);
429 Bytes
Binary file not shown.

src/testdir/test_crash.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ func Test_crash1_3()
228228
call term_sendkeys(buf, args)
229229
call TermWait(buf, 50)
230230

231+
let file = 'crash/nullptr_regexp_nfa'
232+
let cmn_args = "%s -u NONE -i NONE -n -X -m -n -e -s -S %s -c ':qa!'"
233+
let args = printf(cmn_args, vim, file)
234+
call term_sendkeys(buf, args)
235+
call TermWait(buf, 50)
231236

232237
" clean up
233238
exe buf .. "bw!"

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
701,
707709
/**/
708710
700,
709711
/**/

0 commit comments

Comments
 (0)