Skip to content

Commit cae24be

Browse files
committed
patch 8.0.0705: crash when there is an error in a timer callback
Problem: Crash when there is an error in a timer callback. (Aron Griffis, Ozaki Kiichi) Solution: Check did_throw before discarding an exception. NULLify current_exception when no longer valid.
1 parent 163095f commit cae24be

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/ex_cmds2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ check_due_timer(void)
12351235
if (called_emsg)
12361236
{
12371237
++timer->tr_emsg_count;
1238-
if (!did_throw_save && current_exception != NULL)
1238+
if (!did_throw_save && did_throw && current_exception != NULL)
12391239
discard_current_exception();
12401240
}
12411241
did_emsg = did_emsg_save;

src/ex_eval.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,11 @@ discard_exception(except_T *excp, int was_finished)
640640
void
641641
discard_current_exception(void)
642642
{
643-
discard_exception(current_exception, FALSE);
644-
current_exception = NULL;
643+
if (current_exception != NULL)
644+
{
645+
discard_exception(current_exception, FALSE);
646+
current_exception = NULL;
647+
}
645648
did_throw = FALSE;
646649
need_rethrow = FALSE;
647650
}
@@ -1978,7 +1981,10 @@ enter_cleanup(cleanup_T *csp)
19781981
* there is an extra instance for every call of do_cmdline(), anyway.
19791982
*/
19801983
if (did_throw || need_rethrow)
1984+
{
19811985
csp->exception = current_exception;
1986+
current_exception = NULL;
1987+
}
19821988
else
19831989
{
19841990
csp->exception = NULL;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
705,
767769
/**/
768770
704,
769771
/**/

0 commit comments

Comments
 (0)