diff src/vim9class.c @ 32547:feb9a581eb00 v9.0.1605

patch 9.0.1605: crash when calling method on super in child constructor Commit: https://github.com/vim/vim/commit/114ec813b3a7f70d7a1c86e87226f5273e9d1def Author: Ernie Rael <errael@raelity.com> Date: Sun Jun 4 18:11:35 2023 +0100 patch 9.0.1605: crash when calling method on super in child constructor Problem: Crash when calling method on super in child constructor. (Israel Chauca Fuentes) Solution: Clear the type list. (Ernie Rael, closes #12489, closes #12471)
author Bram Moolenaar <Bram@vim.org>
date Sun, 04 Jun 2023 19:15:03 +0200
parents d542423ef5c9
children 5c4c2d82d751
line wrap: on
line diff
--- a/src/vim9class.c
+++ b/src/vim9class.c
@@ -1025,7 +1025,9 @@ early_ret:
 	    if (*fup == NULL)
 		goto cleanup;
 
-	    mch_memmove(*fup, gap->ga_data, sizeof(ufunc_T *) * gap->ga_len);
+	    if (gap->ga_len != 0)
+		mch_memmove(*fup, gap->ga_data,
+					      sizeof(ufunc_T *) * gap->ga_len);
 	    vim_free(gap->ga_data);
 	    if (loop == 1)
 		cl->class_class_function_count_child = gap->ga_len;