From f946a7ca0971027a71e057c2650fdf63d54543e8 Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Fri, 7 Mar 2014 20:50:30 +0400 Subject: runtime: fix memory corruption and leak in recursive panic handling Recursive panics leave dangling Panic structs in g->panic stack. At best it leads to a Defer leak and incorrect output on a subsequent panic. At worst it arbitrary corrupts heap. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/72480043 --- src/pkg/runtime/runtime.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/pkg/runtime/runtime.h') diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index 6b421348ef..2db18003de 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h @@ -733,7 +733,9 @@ struct Panic Eface arg; // argument to panic uintptr stackbase; // g->stackbase in panic Panic* link; // link to earlier panic + Defer* defer; // current executing defer bool recovered; // whether this panic is over + bool aborted; // the panic was aborted }; /* -- cgit v1.3-5-g9baa