comparison src/eval.c @ 33503:f72004b37b2b v9.0.2001

patch 9.0.2001: Vim9: segfault with islocked() Commit: https://github.com/vim/vim/commit/9771b2a67f825bdc6e5c615141d22c665952dc86 Author: Ernie Rael <errael@raelity.com> Date: Sat Oct 7 22:05:40 2023 +0200 patch 9.0.2001: Vim9: segfault with islocked() Problem: Vim9: segfault with islocked() Solution: Check that the lval pointer is not null for objects and class variables closes: #13295 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
author Christian Brabandt <cb@256bit.org>
date Sat, 07 Oct 2023 22:15:09 +0200
parents bff8ac203a22
children 9dee279ce1c4
comparison
equal deleted inserted replaced
33502:4c2e97be0fbe 33503:f72004b37b2b
1373 1373
1374 if (*p == '.' && v_type != VAR_DICT 1374 if (*p == '.' && v_type != VAR_DICT
1375 && v_type != VAR_OBJECT 1375 && v_type != VAR_OBJECT
1376 && v_type != VAR_CLASS) 1376 && v_type != VAR_CLASS)
1377 { 1377 {
1378 // TODO: have a message with obj/class, not just dict,
1378 if (!quiet) 1379 if (!quiet)
1379 semsg(_(e_dot_can_only_be_used_on_dictionary_str), name); 1380 semsg(_(e_dot_can_only_be_used_on_dictionary_str), name);
1380 return NULL; 1381 return NULL;
1381 } 1382 }
1382 if (v_type != VAR_LIST 1383 if (v_type != VAR_LIST
1383 && v_type != VAR_DICT 1384 && v_type != VAR_DICT
1384 && v_type != VAR_BLOB 1385 && v_type != VAR_BLOB
1385 && v_type != VAR_OBJECT 1386 && v_type != VAR_OBJECT
1386 && v_type != VAR_CLASS) 1387 && v_type != VAR_CLASS)
1387 { 1388 {
1389 // TODO: have a message with obj/class, not just dict/list/blob,
1388 if (!quiet) 1390 if (!quiet)
1389 emsg(_(e_can_only_index_list_dictionary_or_blob)); 1391 emsg(_(e_can_only_index_list_dictionary_or_blob));
1390 return NULL; 1392 return NULL;
1391 } 1393 }
1392 1394
1737 break; 1739 break;
1738 } 1740 }
1739 } 1741 }
1740 } 1742 }
1741 1743
1742 // TODO: dont' check access if inside class
1743 // TODO: is GLV_READ_ONLY the right thing to use
1744 // for class/object member access?
1745 // Probably in some cases. Need inside class check
1746 if (lp->ll_valtype == NULL) 1744 if (lp->ll_valtype == NULL)
1747 { 1745 {
1748 int m_idx; 1746 int m_idx;
1749 ocmember_T *om 1747 ocmember_T *om
1750 = member_lookup(cl, v_type, key, p - key, &m_idx); 1748 = member_lookup(cl, v_type, key, p - key, &m_idx);