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

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

Issue 2418483002: [wasm] test deserialization when header is invalid (Closed)
Patch Set: test method to alter header 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
Index: src/snapshot/serializer-common.h
diff --git a/src/snapshot/serializer-common.h b/src/snapshot/serializer-common.h
index 74b02180739e4138f086546d04f8df7515bff114..1ca0a5f732a332ddc07c1f5695b7c17dc82f0a44 100644
--- a/src/snapshot/serializer-common.h
+++ b/src/snapshot/serializer-common.h
@@ -253,11 +253,15 @@ class SerializedData {
}
protected:
- void SetHeaderValue(int offset, uint32_t value) {
- uint32_t* address = reinterpret_cast<uint32_t*>(data_ + offset);
+ static void SetHeaderValueInBuffer(byte* buffer, int offset, uint32_t value) {
+ uint32_t* address = reinterpret_cast<uint32_t*>(buffer + offset);
memcpy(reinterpret_cast<uint32_t*>(address), &value, sizeof(value));
}
+ void SetHeaderValue(int offset, uint32_t value) {
+ SetHeaderValueInBuffer(data_, offset, value);
+ }
+
uint32_t GetHeaderValue(int offset) const {
uint32_t value;
memcpy(&value, reinterpret_cast<int*>(data_ + offset), sizeof(value));

Powered by Google App Engine
This is Rietveld 408576698