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

Unified Diff: runtime/vm/kernel_binary_flowgraph.cc

Issue 2985193002: [vm] Add error messages for large literals coming from kernel (Closed)
Patch Set: Add UNREACHABLE() after ReportError Created 3 years, 5 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 | runtime/vm/kernel_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_binary_flowgraph.cc
diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc
index 34a20248b9bb9d8047dbf2d32c18c374395226b6..21311b2c2f6bf959a4d975cca8175f2261b50ae0 100644
--- a/runtime/vm/kernel_binary_flowgraph.cc
+++ b/runtime/vm/kernel_binary_flowgraph.cc
@@ -2267,6 +2267,10 @@ void StreamingConstantEvaluator::EvaluateBigIntLiteral() {
const dart::String& value =
H.DartString(builder_->ReadStringReference()); // read string reference.
result_ = Integer::New(value, Heap::kOld);
+ if (result_.IsNull()) {
+ H.ReportError("Integer literal %s is out of range", value.ToCString());
+ UNREACHABLE();
+ }
result_ = H.Canonicalize(result_);
}
@@ -5774,7 +5778,13 @@ Fragment StreamingFlowGraphBuilder::BuildBigIntLiteral(
const dart::String& value =
H.DartString(ReadStringReference()); // read index into string table.
- return Constant(Integer::ZoneHandle(Z, Integer::New(value, Heap::kOld)));
+ const Integer& integer =
+ Integer::ZoneHandle(Z, Integer::New(value, Heap::kOld));
+ if (integer.IsNull()) {
+ H.ReportError("Integer literal %s is out of range", value.ToCString());
+ UNREACHABLE();
+ }
+ return Constant(integer);
}
Fragment StreamingFlowGraphBuilder::BuildStringLiteral(
« no previous file with comments | « no previous file | runtime/vm/kernel_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698