Mercurial > vim
comparison src/ex_docmd.c @ 23171:bb7531f77529 v8.2.2131
patch 8.2.2131: Vim9: crash when lambda uses same var as assignment
Commit: https://github.com/vim/vim/commit/709664cca0b59b69caa1ed40ebfcf00b2c672693
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 12 14:33:41 2020 +0100
patch 8.2.2131: Vim9: crash when lambda uses same var as assignment
Problem: Vim9: crash when lambda uses same var as assignment.
Solution: Do not let lookup_local change lv_from_outer, make a copy.
(closes #7461)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 12 Dec 2020 14:45:05 +0100 |
parents | a916fca16d4b |
children | 821701ecbde7 |
comparison
equal
deleted
inserted
replaced
23170:586c5efd71b1 | 23171:bb7531f77529 |
---|---|
3269 */ | 3269 */ |
3270 char_u * | 3270 char_u * |
3271 find_ex_command( | 3271 find_ex_command( |
3272 exarg_T *eap, | 3272 exarg_T *eap, |
3273 int *full UNUSED, | 3273 int *full UNUSED, |
3274 void *(*lookup)(char_u *, size_t, cctx_T *) UNUSED, | 3274 int (*lookup)(char_u *, size_t, void *, cctx_T *) UNUSED, |
3275 cctx_T *cctx UNUSED) | 3275 cctx_T *cctx UNUSED) |
3276 { | 3276 { |
3277 int len; | 3277 int len; |
3278 char_u *p; | 3278 char_u *p; |
3279 int i; | 3279 int i; |
3385 { | 3385 { |
3386 if (((p - eap->cmd) > 2 && eap->cmd[1] == ':') | 3386 if (((p - eap->cmd) > 2 && eap->cmd[1] == ':') |
3387 || *eap->cmd == '&' | 3387 || *eap->cmd == '&' |
3388 || *eap->cmd == '$' | 3388 || *eap->cmd == '$' |
3389 || *eap->cmd == '@' | 3389 || *eap->cmd == '@' |
3390 || lookup(eap->cmd, p - eap->cmd, cctx) != NULL) | 3390 || lookup(eap->cmd, p - eap->cmd, NULL, cctx) == OK) |
3391 { | 3391 { |
3392 eap->cmdidx = CMD_var; | 3392 eap->cmdidx = CMD_var; |
3393 return eap->cmd; | 3393 return eap->cmd; |
3394 } | 3394 } |
3395 } | 3395 } |