diff options
Diffstat (limited to 'projects/libzmq')
-rw-r--r-- | projects/libzmq/Dockerfile | 22 | ||||
-rwxr-xr-x | projects/libzmq/build.sh | 30 | ||||
-rw-r--r-- | projects/libzmq/decode_fuzzer.cc | 28 | ||||
-rw-r--r-- | projects/libzmq/project.yaml | 9 |
4 files changed, 89 insertions, 0 deletions
diff --git a/projects/libzmq/Dockerfile b/projects/libzmq/Dockerfile new file mode 100644 index 00000000..552c982f --- /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 00000000..be98e338 --- /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 00000000..cedf8ee6 --- /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 00000000..42dad7fb --- /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 |