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

Unified Diff: runtime/vm/dart_api_message.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_api_message.cc
===================================================================
--- runtime/vm/dart_api_message.cc (revision 10993)
+++ runtime/vm/dart_api_message.cc (working copy)
@@ -11,10 +11,8 @@
static const int kNumInitialReferences = 4;
-ApiMessageReader::ApiMessageReader(const uint8_t* buffer,
- intptr_t length,
- ReAlloc alloc)
- : BaseReader(buffer, length),
+ApiMessageReader::ApiMessageReader(const Snapshot* snapshot, ReAlloc alloc)
+ : BaseReader(snapshot->content(), snapshot->length()),
alloc_(alloc),
backward_references_(kNumInitialReferences) {
Init();
@@ -460,7 +458,7 @@
}
-void ApiMessageWriter::WriteMessage(intptr_t field_count, intptr_t *data) {
+intptr_t ApiMessageWriter::WriteMessage(intptr_t field_count, intptr_t *data) {
// Write out the serialization header value for this object.
WriteInlinedObjectHeader(kMaxPredefinedObjectIds);
@@ -479,7 +477,7 @@
Write<RawObject*>(Integer::New(data[i]));
}
- FinalizeBuffer();
+ return FinalizeBuffer();
}
@@ -773,7 +771,7 @@
}
-void ApiMessageWriter::WriteCMessage(Dart_CObject* object) {
+intptr_t ApiMessageWriter::WriteCMessage(Dart_CObject* object) {
WriteCObject(object);
// Write out all objects that were added to the forward list and have
// not been serialized yet. These would typically be fields of arrays.
@@ -782,7 +780,7 @@
WriteForwardedCObject(forward_list_[i]);
}
UnmarkAllCObjects(object);
- FinalizeBuffer();
+ return FinalizeBuffer();
}
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698