Mirror of the Vim source from https://github.com/vim/vim
修訂 | 84fca115b1bb399286045bb5e95aa524c6f25dc3 (tree) |
---|---|
時間 | 2020-10-31 02:45:04 |
作者 | Bram Moolenaar <Bram@vim....> |
Commiter | Bram Moolenaar |
patch 8.2.1924: Vim9: crash when indexing dict with NULL key
Commit: https://github.com/vim/vim/commit/086fc9a585afa4317046fa0a36c7b896286e5128
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 30 18:33:02 2020 +0100
@@ -1699,7 +1699,7 @@ | ||
1699 | 1699 | EXTERN char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s")); |
1700 | 1700 | EXTERN char e_toofewarg[] INIT(= N_("E119: Not enough arguments for function: %s")); |
1701 | 1701 | EXTERN char e_func_deleted[] INIT(= N_("E933: Function was deleted: %s")); |
1702 | -EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s")); | |
1702 | +EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\"")); | |
1703 | 1703 | EXTERN char e_listreq[] INIT(= N_("E714: List required")); |
1704 | 1704 | EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required")); |
1705 | 1705 | EXTERN char e_list_end[] INIT(= N_("E697: Missing end of List ']': %s")); |
@@ -1917,6 +1917,7 @@ | ||
1917 | 1917 | CheckDefExecFailure(['var x: dict<string> = #{a: "x", b: 134}'], 'E1012:', 1) |
1918 | 1918 | |
1919 | 1919 | CheckDefFailure(['var x = ({'], 'E723:', 2) |
1920 | + CheckDefExecFailure(['{}[getftype("")]'], 'E716: Key not present in Dictionary: ""', 1) | |
1920 | 1921 | enddef |
1921 | 1922 | |
1922 | 1923 | def Test_expr7_dict_vim9script() |
@@ -751,6 +751,8 @@ | ||
751 | 751 | static int included_patches[] = |
752 | 752 | { /* Add new patch number below this line */ |
753 | 753 | /**/ |
754 | + 1924, | |
755 | +/**/ | |
754 | 756 | 1923, |
755 | 757 | /**/ |
756 | 758 | 1922, |
@@ -2607,6 +2607,8 @@ | ||
2607 | 2607 | tv = STACK_TV_BOT(-1); |
2608 | 2608 | // no need to check for VAR_STRING, 2STRING will check. |
2609 | 2609 | key = tv->vval.v_string; |
2610 | + if (key == NULL) | |
2611 | + key = (char_u *)""; | |
2610 | 2612 | |
2611 | 2613 | if ((di = dict_find(dict, key, -1)) == NULL) |
2612 | 2614 | { |