diff --git a/projects/clib/Dockerfile b/projects/clib/Dockerfile new file mode 100644 index 000000000..92e14901e --- /dev/null +++ b/projects/clib/Dockerfile @@ -0,0 +1,21 @@ +# 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 +RUN apt-get update && apt-get install -y make cmake ninja libcurl4-gnutls-dev -qq +RUN git clone https://github.com/clibs/clib +WORKDIR $SRC/ +COPY build.sh $SRC/ diff --git a/projects/clib/build.sh b/projects/clib/build.sh new file mode 100644 index 000000000..c48ba9d76 --- /dev/null +++ b/projects/clib/build.sh @@ -0,0 +1,36 @@ +#!/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. +# +################################################################################ + +cd clib +make -j$(nproc) + +sed 's/int main(int argc/int main2(int argc/g' -i ./src/clib-search.c +sed 's/int main(int argc/int main2(int argc/g' -i ./src/clib-configure.c + +find . -name "*.o" -exec ar rcs fuzz_lib.a {} \; + +$CC $CFLAGS -Wno-unused-function -U__STRICT_ANSI__ \ + -DHAVE_PTHREADS=1 -pthread -o fuzz_manifest.o \ + -c test/fuzzing/fuzz_manifest.c -I./asprintf -I./deps/ \ + -I./deps/asprintf + +$CC $CFLAGS $LIB_FUZZING_ENGINE fuzz_manifest.o \ + -o $OUT/fuzz_manifest src/common/clib-package.c \ + src/common/clib-cache.c src/clib-configure.c \ + -I./deps/asprintf -I./deps -I./asprintf \ + fuzz_lib.a -L/usr/lib/x86_64-linux-gnu -lcurl + diff --git a/projects/clib/project.yaml b/projects/clib/project.yaml new file mode 100644 index 000000000..6cf186991 --- /dev/null +++ b/projects/clib/project.yaml @@ -0,0 +1,13 @@ +homepage: "https://github.com/clibs/clib" +language: c +primary_contact: "joseph.werle@gmail.com" +auto_ccs: + - "Adam@adalogics.com" + - "isty001@gmail.com" +fuzzing_engines: + - libfuzzer + - honggfuzz +sanitizers: + - address + - undefined + - memory