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

Unified Diff: src/snapshot/code-serializer.cc

Issue 2237883002: [serializer] checksum a larger part of the code snapshot. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: . Created 4 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
« no previous file with comments | « src/snapshot/code-serializer.h ('k') | src/snapshot/deserializer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/code-serializer.cc
diff --git a/src/snapshot/code-serializer.cc b/src/snapshot/code-serializer.cc
index 601659a1490aed7c8805c6b3f0a37b8095224559..8d2f5d933994cbab63e6451973137fe11c50496a 100644
--- a/src/snapshot/code-serializer.cc
+++ b/src/snapshot/code-serializer.cc
@@ -315,10 +315,6 @@ SerializedCodeData::SerializedCodeData(const List<byte>* payload,
SetHeaderValue(kNumCodeStubKeysOffset, num_stub_keys);
SetHeaderValue(kPayloadLengthOffset, payload->length());
- Checksum checksum(payload->ToConstVector());
- SetHeaderValue(kChecksum1Offset, checksum.a());
- SetHeaderValue(kChecksum2Offset, checksum.b());
-
// Copy reservation chunk sizes.
CopyBytes(data_ + kHeaderSize, reinterpret_cast<byte*>(reservations.begin()),
reservation_size);
@@ -332,6 +328,10 @@ SerializedCodeData::SerializedCodeData(const List<byte>* payload,
// Copy serialized data.
CopyBytes(data_ + padded_payload_offset, payload->begin(),
static_cast<size_t>(payload->length()));
+
+ Checksum checksum(DataWithoutHeader());
+ SetHeaderValue(kChecksum1Offset, checksum.a());
+ SetHeaderValue(kChecksum2Offset, checksum.b());
}
SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck(
@@ -350,7 +350,7 @@ SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck(
return CPU_FEATURES_MISMATCH;
}
if (flags_hash != FlagList::Hash()) return FLAGS_MISMATCH;
- if (!Checksum(Payload()).Check(c1, c2)) return CHECKSUM_MISMATCH;
+ if (!Checksum(DataWithoutHeader()).Check(c1, c2)) return CHECKSUM_MISMATCH;
return CHECK_SUCCESS;
}
« no previous file with comments | « src/snapshot/code-serializer.h ('k') | src/snapshot/deserializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698