comparison src/ex_eval.c @ 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 71b57779177d
children f8382c4e6551
comparison
equal deleted inserted replaced
23234:802307c90329 23235:22037d6da577
604 static void 604 static void
605 discard_exception(except_T *excp, int was_finished) 605 discard_exception(except_T *excp, int was_finished)
606 { 606 {
607 char_u *saved_IObuff; 607 char_u *saved_IObuff;
608 608
609 if (current_exception == excp)
610 current_exception = NULL;
609 if (excp == NULL) 611 if (excp == NULL)
610 { 612 {
611 internal_error("discard_exception()"); 613 internal_error("discard_exception()");
612 return; 614 return;
613 } 615 }
652 */ 654 */
653 void 655 void
654 discard_current_exception(void) 656 discard_current_exception(void)
655 { 657 {
656 if (current_exception != NULL) 658 if (current_exception != NULL)
657 {
658 discard_exception(current_exception, FALSE); 659 discard_exception(current_exception, FALSE);
659 current_exception = NULL;
660 }
661 did_throw = FALSE; 660 did_throw = FALSE;
662 need_rethrow = FALSE; 661 need_rethrow = FALSE;
663 } 662 }
664 663
665 /* 664 /*
2282 if (cstack->cs_pending[idx] & CSTP_THROW) 2281 if (cstack->cs_pending[idx] & CSTP_THROW)
2283 { 2282 {
2284 // Cancel the pending exception. This is in the 2283 // Cancel the pending exception. This is in the
2285 // finally clause, so that the stack of the 2284 // finally clause, so that the stack of the
2286 // caught exceptions is not involved. 2285 // caught exceptions is not involved.
2287 discard_exception((except_T *) 2286 discard_exception(
2288 cstack->cs_exception[idx], 2287 (except_T *)cstack->cs_exception[idx],
2289 FALSE); 2288 FALSE);
2290 } 2289 }
2291 else 2290 else
2292 report_discard_pending(cstack->cs_pending[idx], 2291 report_discard_pending(cstack->cs_pending[idx],
2293 NULL); 2292 NULL);