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

Unified Diff: test/fuzzer/wasm-section-fuzzers.cc

Issue 2345593003: [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures and TSAN races. Created 4 years, 3 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 | « test/fuzzer/wasm-section-fuzzers.h ('k') | test/fuzzer/wasm-types-section.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/fuzzer/wasm-section-fuzzers.cc
diff --git a/test/fuzzer/wasm-section-fuzzers.cc b/test/fuzzer/wasm-section-fuzzers.cc
index 63bad10bee1cecbb9da7332cadb1e22e656f1247..7770ee306e85e9783d491c648a196cbcc9f22c24 100644
--- a/test/fuzzer/wasm-section-fuzzers.cc
+++ b/test/fuzzer/wasm-section-fuzzers.cc
@@ -15,7 +15,10 @@
using namespace v8::internal::wasm;
-int fuzz_wasm_section(WasmSection::Code section, const uint8_t* data,
+static const char* kNameString = "name";
+static const size_t kNameStringLength = 4;
+
+int fuzz_wasm_section(WasmSectionCode section, const uint8_t* data,
size_t size) {
v8_fuzzer::FuzzerSupport* support = v8_fuzzer::FuzzerSupport::Get();
v8::Isolate* isolate = support->GetIsolate();
@@ -38,12 +41,18 @@ int fuzz_wasm_section(WasmSection::Code section, const uint8_t* data,
ZoneBuffer buffer(&zone);
buffer.write_u32(kWasmMagic);
buffer.write_u32(kWasmVersion);
- const char* name = WasmSection::getName(section);
- size_t length = WasmSection::getNameLength(section);
- buffer.write_size(length); // Section name string size.
- buffer.write(reinterpret_cast<const uint8_t*>(name), length);
- buffer.write_u32v(static_cast<uint32_t>(size));
- buffer.write(data, size);
+ if (section == kNameSectionCode) {
+ buffer.write_u8(kUnknownSectionCode);
+ buffer.write_size(size + kNameStringLength + 1);
+ buffer.write_u8(kNameStringLength);
+ buffer.write(reinterpret_cast<const uint8_t*>(kNameString),
+ kNameStringLength);
+ buffer.write(data, size);
+ } else {
+ buffer.write_u8(section);
+ buffer.write_size(size);
+ buffer.write(data, size);
+ }
ErrorThrower thrower(i_isolate, "decoder");
« no previous file with comments | « test/fuzzer/wasm-section-fuzzers.h ('k') | test/fuzzer/wasm-types-section.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698