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

Unified Diff: src/frames.cc

Issue 1633323002: Fix possible crash in SafeStackFrameIterator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index dfaf3ca5e4d6e838caf31913e62d46ec88375f10..5297bbbbe5a08ce627e4d85a55808ac9d55b6d1d 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -121,15 +121,15 @@ StackFrame* StackFrameIteratorBase::SingletonFor(StackFrame::Type type,
StackFrame* StackFrameIteratorBase::SingletonFor(StackFrame::Type type) {
#define FRAME_TYPE_CASE(type, field) \
- case StackFrame::type: result = &field##_; break;
+ case StackFrame::type: \
+ return &field##_;
- StackFrame* result = NULL;
switch (type) {
case StackFrame::NONE: return NULL;
STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE)
default: break;
}
- return result;
+ return NULL;
#undef FRAME_TYPE_CASE
}
@@ -234,7 +234,7 @@ SafeStackFrameIterator::SafeStackFrameIterator(
}
if (SingletonFor(type) == NULL) return;
frame_ = SingletonFor(type, &state);
- if (frame_ == NULL) return;
+ DCHECK(frame_);
titzer 2016/01/27 08:29:00 Did you run this through the trybots yet? I might
alph 2016/01/27 17:37:14 AFAICT it cannot return NULL if the previous call
Advance();
@@ -272,8 +272,12 @@ void SafeStackFrameIterator::AdvanceOneFrame() {
// Advance to the previous frame.
StackFrame::State state;
StackFrame::Type type = frame_->GetCallerState(&state);
+ if (SingletonFor(type) == NULL) {
yurys 2016/01/26 23:55:57 Maybe if (type < 0 || type >= StackFrame::NUMBER_O
alph 2016/01/27 00:19:36 I like mine more. Moreover it is used elsewhere (l
yurys 2016/01/27 00:22:14 Acknowledged.
+ frame_ = NULL;
+ return;
+ }
frame_ = SingletonFor(type, &state);
- if (frame_ == NULL) return;
+ DCHECK(frame_);
// Check that we have actually moved to the previous frame in the stack.
if (frame_->sp() < last_sp || frame_->fp() < last_fp) {
« 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