changeset 28829:2d0bd5601c30 v8.2.4938

patch 8.2.4938: crash when matching buffer with invalid pattern Commit: https://github.com/vim/vim/commit/a59f2dfd0cf9ee1a584d3de5b7c2d47648e79060 Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 11 11:42:28 2022 +0100 patch 8.2.4938: crash when matching buffer with invalid pattern Problem: Crash when matching buffer with invalid pattern. Solution: Check for NULL regprog.
author Bram Moolenaar <Bram@vim.org>
date Wed, 11 May 2022 12:45:04 +0200
parents f4d6061c882f
children 405c5cf665b0
files src/buffer.c src/testdir/test_buffer.vim src/version.c
diffstat 3 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2932,7 +2932,7 @@ buflist_match(
 
     // First try the short file name, then the long file name.
     match = fname_match(rmp, buf->b_sfname, ignore_case);
-    if (match == NULL)
+    if (match == NULL && rmp->regprog != NULL)
 	match = fname_match(rmp, buf->b_ffname, ignore_case);
 
     return match;
--- a/src/testdir/test_buffer.vim
+++ b/src/testdir/test_buffer.vim
@@ -415,6 +415,10 @@ func Test_buf_pattern_invalid()
   vsplit 0000000
   silent! buf [0--]\&\zs*\zs*e
   bwipe!
+
+  vsplit 00000000000000000000000000
+  silent! buf [0--]\&\zs*\zs*e
+  bwipe!
 endfunc
 
 " Test for the 'maxmem' and 'maxmemtot' options
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4938,
+/**/
     4937,
 /**/
     4936,