mirror of
				https://github.com/vim/vim.git
				synced 2025-10-30 09:47:20 -04:00 
			
		
		
		
	patch 9.0.0212: invalid memory access when compiling :unlet
Problem: Invalid memory access when compiling :unlet. Solution: Don't read past the end of the line.
This commit is contained in:
		| @@ -1740,12 +1740,19 @@ def Test_lockvar() | |||||||
|  |  | ||||||
|   lines =<< trim END |   lines =<< trim END | ||||||
|       def _() |       def _() | ||||||
|         s:0([], s:0) |  | ||||||
|         lockv |         lockv | ||||||
|       enddef |       enddef | ||||||
|       defcomp |       defcomp | ||||||
|   END |   END | ||||||
|   v9.CheckScriptFailure(lines, 'E179', 2) |   v9.CheckScriptFailure(lines, 'E179', 1) | ||||||
|  |  | ||||||
|  |   lines =<< trim END | ||||||
|  |       def T() | ||||||
|  |         unlet | ||||||
|  |       enddef | ||||||
|  |       defcomp | ||||||
|  |   END | ||||||
|  |   v9.CheckScriptFailure(lines, 'E179', 1) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| def Test_substitute_expr() | def Test_substitute_expr() | ||||||
|   | |||||||
| @@ -735,6 +735,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     212, | ||||||
| /**/ | /**/ | ||||||
|     211, |     211, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
| @@ -92,6 +92,12 @@ free_locals(cctx_T *cctx) | |||||||
|     int |     int | ||||||
| check_vim9_unlet(char_u *name) | check_vim9_unlet(char_u *name) | ||||||
| { | { | ||||||
|  |     if (*name == NUL) | ||||||
|  |     { | ||||||
|  | 	semsg(_(e_argument_required_for_str), "unlet"); | ||||||
|  | 	return FAIL; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL) |     if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL) | ||||||
|     { |     { | ||||||
| 	// "unlet s:var" is allowed in legacy script. | 	// "unlet s:var" is allowed in legacy script. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user