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

Unified Diff: src/compiler/node.h

Issue 1149563004: [turbofan] Add bounds check to Node::InputAt(index) and fix tests that go out of bounds. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/compiler/arm64/instruction-selector-arm64.cc ('k') | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node.h
diff --git a/src/compiler/node.h b/src/compiler/node.h
index aa0d393dbd7e9e765a0b4d7961148ac7e14a3d59..0c8f1205a70430fe35bf34d7db00aaf9f85e3f02 100644
--- a/src/compiler/node.h
+++ b/src/compiler/node.h
@@ -58,7 +58,15 @@ class Node final {
NodeId id() const { return id_; }
int InputCount() const { return input_count(); }
- Node* InputAt(int index) const { return GetInputRecordPtr(index)->to; }
+ Node* InputAt(int index) const {
+#if DEBUG
+ if (index < 0 || index >= InputCount()) {
+ V8_Fatal(__FILE__, __LINE__, "Node #%d:%s->InputAt(%d) out of bounds",
+ id(), op()->mnemonic(), index);
+ }
+#endif
+ return GetInputRecordPtr(index)->to;
+ }
inline void ReplaceInput(int index, Node* new_to);
void AppendInput(Zone* zone, Node* new_to);
void InsertInput(Zone* zone, int index, Node* new_to);
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698