summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools/fuzzing/random.cpp4
-rw-r--r--test/unit/test_fuzz_empty_data.py14
2 files changed, 16 insertions, 2 deletions
diff --git a/src/tools/fuzzing/random.cpp b/src/tools/fuzzing/random.cpp
index 3d8297c15..8beda478b 100644
--- a/src/tools/fuzzing/random.cpp
+++ b/src/tools/fuzzing/random.cpp
@@ -20,8 +20,8 @@
namespace wasm {
-Random::Random(std::vector<char>&& bytes, FeatureSet features)
- : bytes(std::move(bytes)), features(features) {
+Random::Random(std::vector<char>&& bytes_, FeatureSet features)
+ : bytes(std::move(bytes_)), features(features) {
// Ensure there is *some* input to be read.
if (bytes.empty()) {
bytes.push_back(0);
diff --git a/test/unit/test_fuzz_empty_data.py b/test/unit/test_fuzz_empty_data.py
new file mode 100644
index 000000000..3206fcead
--- /dev/null
+++ b/test/unit/test_fuzz_empty_data.py
@@ -0,0 +1,14 @@
+import os
+import tempfile
+from scripts.test import shared
+from . import utils
+
+
+class EmptyDataFuzzTest(utils.BinaryenTestCase):
+ def test_empty_data(self):
+ try:
+ temp = tempfile.NamedTemporaryFile(delete=False).name
+ shared.run_process(shared.WASM_OPT + ['-ttf', temp],
+ capture_output=True)
+ finally:
+ os.unlink(temp)