comparison src/ex_docmd.c @ 24984:71b1e2ef0069 v8.2.3029

patch 8.2.3029: Vim9: crash when using operator and list unpack assignment Commit: https://github.com/vim/vim/commit/035bd1c99f2a8eda5ee886adde4f97ea71fb167f Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 21 19:44:11 2021 +0200 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment Problem: Vim9: crash when using operator and list unpack assignment. (Naohiro Ono) Solution: Get variable value before operation. (closes #8416)
author Bram Moolenaar <Bram@vim.org>
date Mon, 21 Jun 2021 19:45:03 +0200
parents 7f4a04820b5d
children 8f2262c72178
comparison
equal deleted inserted replaced
24983:94f7f4cd68b7 24984:71b1e2ef0069
3483 // follows. 3483 // follows.
3484 // If "[...]" has a line break "p" still points at the "[" and it 3484 // If "[...]" has a line break "p" still points at the "[" and it
3485 // can't be an assignment. 3485 // can't be an assignment.
3486 if (*eap->cmd == '[') 3486 if (*eap->cmd == '[')
3487 { 3487 {
3488 char_u *eq;
3489
3488 p = to_name_const_end(eap->cmd); 3490 p = to_name_const_end(eap->cmd);
3489 if (p == eap->cmd && *p == '[') 3491 if (p == eap->cmd && *p == '[')
3490 { 3492 {
3491 int count = 0; 3493 int count = 0;
3492 int semicolon = FALSE; 3494 int semicolon = FALSE;
3493 3495
3494 p = skip_var_list(eap->cmd, TRUE, &count, &semicolon, TRUE); 3496 p = skip_var_list(eap->cmd, TRUE, &count, &semicolon, TRUE);
3495 } 3497 }
3496 if (p == NULL || p == eap->cmd || *skipwhite(p) != '=') 3498 eq = p;
3499 if (eq != NULL)
3500 {
3501 eq = skipwhite(eq);
3502 if (vim_strchr((char_u *)"+-*/%", *eq) != NULL)
3503 ++eq;
3504 }
3505 if (p == NULL || p == eap->cmd || *eq != '=')
3497 { 3506 {
3498 eap->cmdidx = CMD_eval; 3507 eap->cmdidx = CMD_eval;
3499 return eap->cmd; 3508 return eap->cmd;
3500 } 3509 }
3501 if (p > eap->cmd && *skipwhite(p) == '=') 3510 if (p > eap->cmd && *eq == '=')
3502 { 3511 {
3503 eap->cmdidx = CMD_var; 3512 eap->cmdidx = CMD_var;
3504 return eap->cmd; 3513 return eap->cmd;
3505 } 3514 }
3506 } 3515 }