Skip to content

Commit c9bfed2

Browse files
committed
patch 9.1.0703: crash with 2byte encoding and glob2regpat()
Problem: possible crash with 2-byte encoding and glob2regpat() (after v9.1.0700, v9.1.0702) Solution: include both bytes for a multi-byte character for an escaped character closes: #15590 Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 87c01d9 commit c9bfed2

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/fileio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5714,6 +5714,8 @@ file_pat_to_reg_pat(
57145714
)
57155715
*allow_dirs = TRUE;
57165716
reg_pat[i++] = '\\';
5717+
if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1)
5718+
reg_pat[i++] = *p++;
57175719
reg_pat[i++] = *p;
57185720
}
57195721
break;

src/testdir/test_crash.vim

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ func Test_crash1_3()
222222
call term_sendkeys(buf, args)
223223
call TermWait(buf, 150)
224224

225-
" let file = 'crash/heap_overflow_glob2regpat'
226-
" let cmn_args = "%s -u NONE -i NONE -n -X -m -n -e -s -S %s -c ':qa!'"
227-
" let args = printf(cmn_args, vim, file)
228-
" call term_sendkeys(buf, args)
229-
" call TermWait(buf, 50)
225+
let file = 'crash/heap_overflow_glob2regpat'
226+
let cmn_args = "%s -u NONE -i NONE -n -X -m -n -e -s -S %s -c ':qa!'"
227+
let args = printf(cmn_args, vim, file)
228+
call term_sendkeys(buf, args)
229+
call TermWait(buf, 50)
230230

231231
let file = 'crash/nullptr_regexp_nfa'
232232
let cmn_args = "%s -u NONE -i NONE -n -X -m -n -e -s -S %s -c ':qa!'"

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+
703,
707709
/**/
708710
702,
709711
/**/

0 commit comments

Comments
 (0)