aboutsummaryrefslogtreecommitdiff
path: root/projects/libzmq
diff options
context:
space:
mode:
authorGoogle AutoFuzz Team <security-tps@google.com>2020-04-23 02:37:04 +0200
committerGitHub <noreply@github.com>2020-04-23 10:37:04 +1000
commit0fc436aad9f25e3b56a45589aac7d99334a544d3 (patch)
tree3ff4907e6d78ac41184c3455b420339c436a659a /projects/libzmq
parenta6b8cd8498b1c875c0ebde367f0fe5bafbb9ccf7 (diff)
downloadoss-fuzz-0fc436aad9f25e3b56a45589aac7d99334a544d3.tar.gz
Add libzmq (#3690)
Diffstat (limited to 'projects/libzmq')
-rw-r--r--projects/libzmq/Dockerfile22
-rwxr-xr-xprojects/libzmq/build.sh30
-rw-r--r--projects/libzmq/decode_fuzzer.cc28
-rw-r--r--projects/libzmq/project.yaml9
4 files changed, 89 insertions, 0 deletions
diff --git a/projects/libzmq/Dockerfile b/projects/libzmq/Dockerfile
new file mode 100644
index 000000000..552c982f5
--- /dev/null
+++ b/projects/libzmq/Dockerfile
@@ -0,0 +1,22 @@
+# Copyright 2020 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 bluca@debian.org
+RUN apt-get update && apt-get install -y make autoconf automake libtool gettext pkg-config build-essential
+RUN git clone --depth 1 https://github.com/zeromq/libzmq.git
+WORKDIR libzmq
+COPY build.sh *.cc $SRC/
diff --git a/projects/libzmq/build.sh b/projects/libzmq/build.sh
new file mode 100755
index 000000000..be98e3388
--- /dev/null
+++ b/projects/libzmq/build.sh
@@ -0,0 +1,30 @@
+#!/bin/bash -eu
+# Copyright 2020 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
+cd $SRC/libzmq
+./autogen.sh --disable-shared
+./configure
+make -j$(nproc) V=1
+
+# build fuzzers
+for fuzzers in $(find $SRC -name '*_fuzzer.cc'); do
+ fuzz_basename=$(basename -s .cc $fuzzers)
+ $CXX $CXXFLAGS -std=c++11 -I. \
+ $fuzzers $LIB_FUZZING_ENGINE ./src/.libs/libzmq.a \
+ -o $OUT/$fuzz_basename
+done
diff --git a/projects/libzmq/decode_fuzzer.cc b/projects/libzmq/decode_fuzzer.cc
new file mode 100644
index 000000000..cedf8ee65
--- /dev/null
+++ b/projects/libzmq/decode_fuzzer.cc
@@ -0,0 +1,28 @@
+// 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 <fuzzer/FuzzedDataProvider.h>
+
+#include <cstddef>
+#include <cstdint>
+#include <string>
+
+#include "include/zmq.h"
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ uint8_t secret_key[32];
+ std::string z85_secret_key(reinterpret_cast<const char *>(data), size);
+ zmq_z85_decode(secret_key, z85_secret_key.c_str());
+ return 0;
+}
diff --git a/projects/libzmq/project.yaml b/projects/libzmq/project.yaml
new file mode 100644
index 000000000..42dad7fb1
--- /dev/null
+++ b/projects/libzmq/project.yaml
@@ -0,0 +1,9 @@
+homepage: "https://github.com/zeromq/libzmq"
+language: c++
+primary_contact: "bluca@debian.org"
+sanitizers:
+ - address
+ - memory
+architectures:
+ - x86_64
+ - i386