Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: runtime/vm/debugger.cc

Issue 9726017: Fix use-after-free bug in debugger (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
===================================================================
--- runtime/vm/debugger.cc (revision 5651)
+++ runtime/vm/debugger.cc (working copy)
@@ -317,12 +317,23 @@
pc_ = desc.PC(pc_desc_index);
ASSERT(pc_ != 0);
breakpoint_kind_ = desc.DescriptorKind(pc_desc_index);
+ ASSERT((breakpoint_kind_ == PcDescriptors::kIcCall) ||
+ (breakpoint_kind_ == PcDescriptors::kFuncCall) ||
+ (breakpoint_kind_ == PcDescriptors::kReturn));
}
CodeBreakpoint::~CodeBreakpoint() {
// Make sure we don't leave patched code behind.
ASSERT(!IsEnabled());
+ // Poison the data so we catch use after free errors.
+#ifdef DEBUG
+ function_ = Function::null();
+ pc_ = 0ul;
+ src_bpt_ = NULL;
+ next_ = NULL;
+ breakpoint_kind_ = PcDescriptors::kOther;
+#endif
}
@@ -518,6 +529,7 @@
return;
}
}
+ RemoveInternalBreakpoints();
Code& code = Code::Handle(target_function.unoptimized_code());
ASSERT(!code.IsNull());
PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors());
@@ -880,12 +892,10 @@
if (stack_trace->Length() > 1) {
ActivationFrame* caller = stack_trace->ActivationFrameAt(1);
func = caller->DartFunction().raw();
- RemoveInternalBreakpoints();
}
}
InstrumentForStepping(func);
} else if (resume_action_ == kStepInto) {
- RemoveInternalBreakpoints();
if (bpt->breakpoint_kind_ == PcDescriptors::kIcCall) {
int num_args, num_named_args;
uword target;
@@ -916,7 +926,6 @@
} else {
ASSERT(resume_action_ == kStepOut);
// Set stepping breakpoints in the caller.
- RemoveInternalBreakpoints();
if (stack_trace->Length() > 1) {
ActivationFrame* caller = stack_trace->ActivationFrameAt(1);
InstrumentForStepping(caller->DartFunction());
siva 2012/03/19 22:45:22 Ditto question.
hausner 2012/03/19 23:35:15 Ditto.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698