0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1539: using invalid script ID causes a crash

Problem:    Using invalid script ID causes a crash.
Solution:   Check the script ID to be valid. (closes #6804)
This commit is contained in:
Bram Moolenaar
2020-08-29 13:39:17 +02:00
parent 423a85a11a
commit e3d4685f1f
7 changed files with 43 additions and 21 deletions

View File

@@ -524,7 +524,7 @@ list_vim_vars(int *first)
static void
list_script_vars(int *first)
{
if (current_sctx.sc_sid > 0 && current_sctx.sc_sid <= script_items.ga_len)
if (SCRIPT_ID_VALID(current_sctx.sc_sid))
list_hashtable_vars(&SCRIPT_VARS(current_sctx.sc_sid),
"s:", FALSE, first);
}
@@ -2609,7 +2609,7 @@ get_script_local_ht(void)
{
scid_T sid = current_sctx.sc_sid;
if (sid > 0 && sid <= script_items.ga_len)
if (SCRIPT_ID_VALID(sid))
return &SCRIPT_VARS(sid);
return NULL;
}