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

Unified Diff: runtime/vm/dart.cc

Issue 10829444: Avoid trusting the length encoded in the Snapshot if there is an (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
Index: runtime/vm/dart.cc
===================================================================
--- runtime/vm/dart.cc (revision 10993)
+++ runtime/vm/dart.cc (working copy)
@@ -141,7 +141,13 @@
// Initialize from snapshot (this should replicate the functionality
// of Object::Init(..) in a regular isolate creation path.
Object::InitFromSnapshot(isolate);
- const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer);
+ const Snapshot* snapshot =
+ Snapshot::SetupFromBuffer(snapshot_buffer, Snapshot::kTrustedLength);
+ if (snapshot == NULL) {
+ const String& message = String::Handle(String::New(
+ "Unexpected error during snapshot parsing."));
+ return ApiError::New(message);
+ }
if (FLAG_trace_isolates) {
OS::Print("Size of isolate snapshot = %ld\n", snapshot->length());
}

Powered by Google App Engine
This is Rietveld 408576698