changeset 23235:22037d6da577 v8.2.2163

patch 8.2.2163: crash when discarded exception is the current exception Commit: https://github.com/vim/vim/commit/13656f02e457fb68cd7e72412fc24ccac02fb06e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 19 17:55:54 2020 +0100 patch 8.2.2163: crash when discarded exception is the current exception Problem: Crash when discarded exception is the current exception. Solution: Compare the execption with current_exception. (closes https://github.com/vim/vim/issues/7499)
author Bram Moolenaar <Bram@vim.org>
date Sat, 19 Dec 2020 18:00:04 +0100
parents 802307c90329
children 1726af77ad66
files src/ex_eval.c src/version.c
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -606,6 +606,8 @@ discard_exception(except_T *excp, int wa
 {
     char_u		*saved_IObuff;
 
+    if (current_exception == excp)
+	current_exception = NULL;
     if (excp == NULL)
     {
 	internal_error("discard_exception()");
@@ -654,10 +656,7 @@ discard_exception(except_T *excp, int wa
 discard_current_exception(void)
 {
     if (current_exception != NULL)
-    {
 	discard_exception(current_exception, FALSE);
-	current_exception = NULL;
-    }
     did_throw = FALSE;
     need_rethrow = FALSE;
 }
@@ -2284,8 +2283,8 @@ cleanup_conditionals(
 				// Cancel the pending exception.  This is in the
 				// finally clause, so that the stack of the
 				// caught exceptions is not involved.
-				discard_exception((except_T *)
-					cstack->cs_exception[idx],
+				discard_exception(
+					(except_T *)cstack->cs_exception[idx],
 					FALSE);
 			    }
 			    else
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2163,
+/**/
     2162,
 /**/
     2161,