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

Unified Diff: runtime/vm/dart.cc

Issue 2481013006: Check that Dart_CreateIsolate is given a correct kind of snapshot. (Closed)
Patch Set: . Created 4 years, 1 month 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 | « runtime/include/dart_api.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart.cc
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 579691ec6714e39e4bd61ad73e82ef08cacc7460..43aebebeb33fe50c242baf2fe59559151ee9544e 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -530,8 +530,14 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
String::New("Invalid snapshot"));
return ApiError::New(message);
}
+ if (snapshot->kind() != snapshot_kind_) {
+ const String& message = String::Handle(
+ String::NewFormatted("Invalid snapshot kind: got '%s', expected '%s'",
+ Snapshot::KindToCString(snapshot->kind()),
+ Snapshot::KindToCString(snapshot_kind_)));
+ return ApiError::New(message);
+ }
ASSERT(Snapshot::IsFull(snapshot->kind()));
- ASSERT(snapshot->kind() == snapshot_kind_);
if (FLAG_trace_isolates) {
OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length());
}
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698