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

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

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 | « src/snapshot/code-serializer.h ('k') | no next file » | 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 2763588bb27e8e73c7ab1ac447948b1f8d69d130..08d761df9e78b986321cf91e8a1af6036b99fbf6 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -5,6 +5,8 @@
#include <stdlib.h>
#include <string.h>
+#include "src/snapshot/code-serializer.h"
+#include "src/version.h"
#include "src/wasm/module-decoder.h"
#include "src/wasm/wasm-macro-gen.h"
#include "src/wasm/wasm-module-builder.h"
@@ -228,9 +230,16 @@ TEST(Run_WasmModule_Serialization) {
create_params.array_buffer_allocator =
CcTest::InitIsolateOnce()->array_buffer_allocator();
- for (int i = 0; i < 2; ++i) {
+ for (int i = 0; i < 3; ++i) {
v8::Isolate* v8_isolate = v8::Isolate::New(create_params);
if (i == 1) {
+ // Invalidate the header by providing a mismatched version
+ uint32_t* buffer = reinterpret_cast<uint32_t*>(
+ const_cast<uint8_t*>(serialized_bytes.first));
+ buffer[SerializedCodeData::kVersionHashOffset] = Version::Hash() + 1;
+ }
+
+ if (i == 2) {
// Provide no serialized data to force recompilation.
serialized_bytes.first = nullptr;
serialized_bytes.second = 0;
« no previous file with comments | « src/snapshot/code-serializer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698