aboutsummaryrefslogtreecommitdiff
path: root/projects/wabt
diff options
context:
space:
mode:
authorGoogle AutoFuzz Team <security-tps@google.com>2019-11-15 10:45:55 -0500
committerjonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2019-11-15 07:45:55 -0800
commit82f519f34081820a2362319a2030846334f8e95e (patch)
treeb1815019d3c0691a146be8a023c56697f56f2dde /projects/wabt
parent3e88bb40f22ebc27cee42aabce78ca1f89bb964d (diff)
downloadoss-fuzz-82f519f34081820a2362319a2030846334f8e95e.tar.gz
[wabt] Add project (#3035)
Diffstat (limited to 'projects/wabt')
-rw-r--r--projects/wabt/Dockerfile24
-rwxr-xr-xprojects/wabt/build.sh32
-rw-r--r--projects/wabt/project.yaml9
-rw-r--r--projects/wabt/wasm2wat_fuzzer.cc27
4 files changed, 92 insertions, 0 deletions
diff --git a/projects/wabt/Dockerfile b/projects/wabt/Dockerfile
new file mode 100644
index 000000000..97a96d3e5
--- /dev/null
+++ b/projects/wabt/Dockerfile
@@ -0,0 +1,24 @@
+# Copyright 2019 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+################################################################################
+
+FROM gcr.io/oss-fuzz-base/base-builder
+MAINTAINER wasm-waterfall@grotations.appspotmail.com
+RUN apt-get update && apt-get install -y cmake libtool make python
+RUN git clone --recursive https://github.com/WebAssembly/wabt
+WORKDIR wabt
+RUN git submodule init
+RUN git submodule update
+COPY build.sh wasm2wat_fuzzer.cc $SRC/
diff --git a/projects/wabt/build.sh b/projects/wabt/build.sh
new file mode 100755
index 000000000..b894e1137
--- /dev/null
+++ b/projects/wabt/build.sh
@@ -0,0 +1,32 @@
+#!/bin/bash -eu
+# Copyright 2019 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+################################################################################
+
+# build project
+mkdir build
+cd build
+cmake ..
+cmake --build .
+cd ..
+
+for fuzzers in $(find $SRC -name '*_fuzzer.cc'); do
+ fuzz_basename=$(basename -s .cc $fuzzers)
+ $CXX $CXXFLAGS -std=c++11 -I. -Ibuild \
+ $fuzzers $LIB_FUZZING_ENGINE ./build/libwabt.a \
+ -o $OUT/$fuzz_basename
+done
+
+
diff --git a/projects/wabt/project.yaml b/projects/wabt/project.yaml
new file mode 100644
index 000000000..ff1b061c1
--- /dev/null
+++ b/projects/wabt/project.yaml
@@ -0,0 +1,9 @@
+homepage: "https://github.com/WebAssembly/wabt"
+primary_contact: "wasm-waterfall@grotations.appspotmail.com"
+sanitizers:
+ - address
+ - memory
+ - undefined
+architectures:
+ - x86_64
+ - i386
diff --git a/projects/wabt/wasm2wat_fuzzer.cc b/projects/wabt/wasm2wat_fuzzer.cc
new file mode 100644
index 000000000..6147ed387
--- /dev/null
+++ b/projects/wabt/wasm2wat_fuzzer.cc
@@ -0,0 +1,27 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "wabt/src/binary-reader-ir.h"
+#include "wabt/src/binary-reader.h"
+#include "wabt/src/common.h"
+#include "wabt/src/ir.h"
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ wabt::ReadBinaryOptions options;
+ wabt::Errors errors;
+ wabt::Module module;
+ wabt::ReadBinaryIr("dummy filename", data, size, options, &errors, &module);
+ return 0;
+}
+