changeset 7765:9c0d554a497e v7.4.1180

commit https://github.com/vim/vim/commit/7465c6375fd60eab603681bcad8a8744ddc31614 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 25 22:20:27 2016 +0100 patch 7.4.1180 Problem: Crash with invalid argument to glob2regpat(). Solution: Check for NULL. (Justin M. Keyes, closes https://github.com/vim/vim/issues/596) Add a test.
author Christian Brabandt <cb@256bit.org>
date Mon, 25 Jan 2016 22:30:05 +0100
parents c500ad63925b
children c131f60919d1
files src/eval.c src/testdir/test_alot.vim src/version.c
diffstat 3 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -12993,7 +12993,8 @@ f_glob2regpat(argvars, rettv)
     char_u	*pat = get_tv_string_chk(&argvars[0]);
 
     rettv->v_type = VAR_STRING;
-    rettv->vval.v_string = file_pat_to_reg_pat(pat, NULL, NULL, FALSE);
+    rettv->vval.v_string = (pat == NULL)
+			 ? NULL : file_pat_to_reg_pat(pat, NULL, NULL, FALSE);
 }
 
 /*
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -5,6 +5,7 @@ source test_backspace_opt.vim
 source test_cursor_func.vim
 source test_delete.vim
 source test_expand.vim
+source test_glob2regpat.vim
 source test_json.vim
 source test_lispwords.vim
 source test_menu.vim
--- 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 */
 /**/
+    1180,
+/**/
     1179,
 /**/
     1178,