patch 9.1.0703: crash with 2byte encoding and glob2regpat()

Commit: 
https://github.com/vim/vim/commit/c9bfed2fda8c23cc02325b1a7a6d84dc62bbea4b
Author: Christian Brabandt <c...@256bit.org>
Date:   Thu Aug 29 22:12:05 2024 +0200

    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 <c...@256bit.org>

diff --git a/src/fileio.c b/src/fileio.c
index d27a1727e..5fee4e0be 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -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;
diff --git a/src/testdir/test_crash.vim b/src/testdir/test_crash.vim
index d6975931b..bfd04ff10 100644
--- a/src/testdir/test_crash.vim
+++ b/src/testdir/test_crash.vim
@@ -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!'"
diff --git a/src/version.c b/src/version.c
index c3e510a92..3c30cbdb4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    703,
 /**/
     702,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sjlmO-00GN03-QC%40256bit.org.

Raspunde prin e-mail lui