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

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

Issue 2418483002: [wasm] test deserialization when header is invalid (Closed)
Patch Set: feedback Created 4 years, 2 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 | « no previous file | test/cctest/wasm/test-run-wasm-module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/code-serializer.h
diff --git a/src/snapshot/code-serializer.h b/src/snapshot/code-serializer.h
index 6577df8c855cc0f1ff8d4c4b4c118222b4a7fc01..7d78bdccdbf1c07f1bfb118944b8e6fc3c9f8b17 100644
--- a/src/snapshot/code-serializer.h
+++ b/src/snapshot/code-serializer.h
@@ -96,6 +96,31 @@ class SerializedCodeData : public SerializedData {
INVALID_HEADER = 7
};
+ // The data header consists of uint32_t-sized entries:
+ // [0] magic number and external reference count
+ // [1] version hash
+ // [2] source hash
+ // [3] cpu features
+ // [4] flag hash
+ // [5] number of code stub keys
+ // [6] number of reservation size entries
+ // [7] payload length
+ // [8] payload checksum part 1
+ // [9] payload checksum part 2
+ // ... reservations
+ // ... code stub keys
+ // ... serialized payload
+ static const int kVersionHashOffset = kMagicNumberOffset + kInt32Size;
+ static const int kSourceHashOffset = kVersionHashOffset + kInt32Size;
+ static const int kCpuFeaturesOffset = kSourceHashOffset + kInt32Size;
+ static const int kFlagHashOffset = kCpuFeaturesOffset + kInt32Size;
+ static const int kNumReservationsOffset = kFlagHashOffset + kInt32Size;
+ static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size;
+ static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size;
+ static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size;
+ static const int kChecksum2Offset = kChecksum1Offset + kInt32Size;
+ static const int kHeaderSize = kChecksum2Offset + kInt32Size;
+
// Used when consuming.
static const SerializedCodeData FromCachedData(
Isolate* isolate, ScriptData* cached_data, uint32_t expected_source_hash,
@@ -125,30 +150,6 @@ class SerializedCodeData : public SerializedData {
SanityCheckResult SanityCheck(Isolate* isolate,
uint32_t expected_source_hash) const;
- // The data header consists of uint32_t-sized entries:
- // [0] magic number and external reference count
- // [1] version hash
- // [2] source hash
- // [3] cpu features
- // [4] flag hash
- // [5] number of code stub keys
- // [6] number of reservation size entries
- // [7] payload length
- // [8] payload checksum part 1
- // [9] payload checksum part 2
- // ... reservations
- // ... code stub keys
- // ... serialized payload
- static const int kVersionHashOffset = kMagicNumberOffset + kInt32Size;
- static const int kSourceHashOffset = kVersionHashOffset + kInt32Size;
- static const int kCpuFeaturesOffset = kSourceHashOffset + kInt32Size;
- static const int kFlagHashOffset = kCpuFeaturesOffset + kInt32Size;
- static const int kNumReservationsOffset = kFlagHashOffset + kInt32Size;
- static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size;
- static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size;
- static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size;
- static const int kChecksum2Offset = kChecksum1Offset + kInt32Size;
- static const int kHeaderSize = kChecksum2Offset + kInt32Size;
};
} // namespace internal
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698