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

Unified Diff: test/cctest/wasm/test-run-wasm-module.cc

Issue 2736923002: SnapshotCreator: start from existing snapshot if we have one (Closed)
Patch Set: addressed comments Created 3 years, 9 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/snapshot-common.cc ('k') | tools/dev/gm.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-module.cc
diff --git a/test/cctest/wasm/test-run-wasm-module.cc b/test/cctest/wasm/test-run-wasm-module.cc
index 03ffb7ac65e5917db85ba5957147e552c4cc4927..a3dd35713dfb23ca4c54fdd2a978716de1b8e544 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -237,9 +237,10 @@ class WasmSerializationTest {
}
void InvalidateVersion() {
- uint32_t* buffer = reinterpret_cast<uint32_t*>(
- const_cast<uint8_t*>(serialized_bytes_.first));
- buffer[SerializedCodeData::kVersionHashOffset] = Version::Hash() + 1;
+ uint32_t* slot = reinterpret_cast<uint32_t*>(
+ const_cast<uint8_t*>(serialized_bytes_.first) +
+ SerializedCodeData::kVersionHashOffset);
+ *slot = Version::Hash() + 1;
}
void InvalidateWireBytes() {
@@ -247,6 +248,13 @@ class WasmSerializationTest {
wire_bytes_.second / 2);
}
+ void InvalidateLength() {
+ uint32_t* slot = reinterpret_cast<uint32_t*>(
+ const_cast<uint8_t*>(serialized_bytes_.first) +
+ SerializedCodeData::kPayloadLengthOffset);
+ *slot = 0xfefefefeu;
+ }
+
v8::MaybeLocal<v8::WasmCompiledModule> Deserialize() {
ErrorThrower thrower(current_isolate(), "");
v8::MaybeLocal<v8::WasmCompiledModule> deserialized =
@@ -406,6 +414,17 @@ TEST(DeserializeNoSerializedData) {
Cleanup();
}
+TEST(DeserializeInvalidLength) {
+ WasmSerializationTest test;
+ {
+ HandleScope scope(test.current_isolate());
+ test.InvalidateLength();
+ test.DeserializeAndRun();
+ }
+ Cleanup(test.current_isolate());
+ Cleanup();
+}
+
TEST(DeserializeWireBytesAndSerializedDataInvalid) {
WasmSerializationTest test;
{
« no previous file with comments | « src/snapshot/snapshot-common.cc ('k') | tools/dev/gm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698