diff src/vim9compile.c @ 31517:cd5247f4da06 v9.0.1091

patch 9.0.1091: assignment to non-existing member causes a crash Commit: https://github.com/vim/vim/commit/f54cedd6763e7727b4bfaeb34bb7c365a17675eb Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 23 17:56:27 2022 +0000 patch 9.0.1091: assignment to non-existing member causes a crash Problem: Assignment to non-existing member causes a crash. (Yegappan Lakshmanan) Solution: Give an error message and bail out when a member cannot be found.
author Bram Moolenaar <Bram@vim.org>
date Fri, 23 Dec 2022 19:00:04 +0100
parents 1bebc2093e6b
children 67d9fbe516a3
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1823,6 +1823,8 @@ compile_lhs(
 	    class_T *cl = (class_T *)lhs->lhs_type->tt_member;
 	    lhs->lhs_member_type = class_member_type(cl, after + 1,
 					   lhs->lhs_end, &lhs->lhs_member_idx);
+	    if (lhs->lhs_member_idx < 0)
+		return FAIL;
 	}
 	else
 	    lhs->lhs_member_type = lhs->lhs_type->tt_member;