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

Unified Diff: src/hydrogen.cc

Issue 653993005: Fix out-of-bounds read in SourcePositionToScriptPosition with --hydrogen-track-positions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | « src/hydrogen.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index e956947495ebdebb7da03741ce57dc1d97f31173..8bb0538dc2f71527fd94d7f3ee97b077d9b6977c 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -144,7 +144,7 @@ void HBasicBlock::AddInstruction(HInstruction* instr,
entry->set_position(position);
} else {
DCHECK(!FLAG_hydrogen_track_positions ||
- !graph()->info()->IsOptimizing());
+ !graph()->info()->IsOptimizing() || instr->IsAbnormalExit());
}
first_ = last_ = entry;
}
@@ -3446,8 +3446,9 @@ HGraph::HGraph(CompilationInfo* info)
maximum_environment_size_(0),
no_side_effects_scope_count_(0),
disallow_adding_new_values_(false),
- next_inline_id_(0),
- inlined_functions_(5, info->zone()) {
+ inlined_functions_(FLAG_hydrogen_track_positions ? 5 : 0, info->zone()),
+ inlining_id_to_function_id_(FLAG_hydrogen_track_positions ? 5 : 0,
+ info->zone()) {
if (info->IsStub()) {
CallInterfaceDescriptor descriptor =
info->code_stub()->GetCallInterfaceDescriptor();
@@ -3527,7 +3528,8 @@ int HGraph::TraceInlinedFunction(
}
}
- int inline_id = next_inline_id_++;
+ int inline_id = inlining_id_to_function_id_.length();
+ inlining_id_to_function_id_.Add(id, zone());
if (inline_id != 0) {
CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
@@ -3546,8 +3548,8 @@ int HGraph::SourcePositionToScriptPosition(HSourcePosition pos) {
return pos.raw();
}
- return inlined_functions_[pos.inlining_id()].start_position() +
- pos.position();
+ const int id = inlining_id_to_function_id_[pos.inlining_id()];
+ return inlined_functions_[id].start_position() + pos.position();
}
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698