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

Unified Diff: runtime/vm/snapshot.cc

Issue 417093005: - Make sure to be able to deal with unaligned snapshot buffers (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
===================================================================
--- runtime/vm/snapshot.cc (revision 38738)
+++ runtime/vm/snapshot.cc (working copy)
@@ -136,6 +136,12 @@
((1 << RawObject::kWatchedBit) | (1 << RawObject::kMarkBit)));
ASSERT((kObjectAlignmentMask & kObjectId) == kObjectId);
const Snapshot* snapshot = reinterpret_cast<const Snapshot*>(raw_memory);
+ // If the raw length is negative or greater than what the local machine can
+ // handle, then signal an error.
+ int64_t snapshot_length = ReadUnaligned(&snapshot->unaligned_length_);
+ if ((snapshot_length < 0) || (snapshot_length > kIntptrMax)) {
+ return NULL;
+ }
return snapshot;
}
« no previous file with comments | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698