aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/runtime.h
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-03-07 20:50:30 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-03-07 20:50:30 +0400
commitf946a7ca0971027a71e057c2650fdf63d54543e8 (patch)
treecb71b4601e9b9147b8941a2cb07adfdeac986de2 /src/pkg/runtime/runtime.h
parentb08156cd874d9534776cd9ece8f6f4ab092a68a5 (diff)
downloadgo-f946a7ca0971027a71e057c2650fdf63d54543e8.tar.xz
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
Diffstat (limited to 'src/pkg/runtime/runtime.h')
-rw-r--r--src/pkg/runtime/runtime.h2
1 files changed, 2 insertions, 0 deletions
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
};
/*