]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0703: crash with 2byte encoding and glob2regpat() v9.1.0703
authorChristian Brabandt <cb@256bit.org>
Thu, 29 Aug 2024 20:12:05 +0000 (22:12 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 29 Aug 2024 20:15:03 +0000 (22:15 +0200)
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>
src/fileio.c
src/testdir/test_crash.vim
src/version.c

index d27a1727ed1718a573316629ef484787f048632b..5fee4e0be970bcd14b94be425197f3071ff48768 100644 (file)
@@ -5714,6 +5714,8 @@ file_pat_to_reg_pat(
                                )
                            *allow_dirs = TRUE;
                        reg_pat[i++] = '\\';
+                       if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1)
+                           reg_pat[i++] = *p++;
                        reg_pat[i++] = *p;
                    }
                break;
index d6975931b393133903e6fba7f716b66438b63c16..bfd04ff10f9a1bb6e04913e7e2e984b76bd39c1e 100644 (file)
@@ -222,11 +222,11 @@ func Test_crash1_3()
   call term_sendkeys(buf, args)
   call TermWait(buf, 150)
 
-  let file = 'crash/heap_overflow_glob2regpat'
-  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)
+  let file = 'crash/heap_overflow_glob2regpat'
+  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)
 
   let file = 'crash/nullptr_regexp_nfa'
   let cmn_args = "%s -u NONE -i NONE -n -X -m -n -e -s -S %s -c ':qa!'"
index c3e510a92a5b5604a4dab4ccff0159d29d9053f5..3c30cbdb44e074ef3e916566729e14e4470df9f0 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    703,
 /**/
     702,
 /**/