From 64a6f69c926f4ed62e906bc37722ef4c1250237f Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Sat, 27 Jul 2019 18:13:39 +0200 Subject: [PATCH] Fix possible invalid memory access when throwing exceptions --- src/core/exceptions.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/exceptions.c b/src/core/exceptions.c index b761b32157..2fcba85b63 100644 --- a/src/core/exceptions.c +++ b/src/core/exceptions.c @@ -599,7 +599,9 @@ MVMObject * MVM_exception_backtrace_strings(MVMThreadContext *tc, MVMObject *ex_ else MVM_exception_throw_adhoc(tc, "Op 'backtracestrings' needs an exception object"); - arr = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTArray); + MVMROOT(tc, ex, { + arr = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTArray); + }); cur_frame = ex->body.origin; MVMROOT2(tc, arr, cur_frame, {