diff options
author | AdamKorcz <44787359+AdamKorcz@users.noreply.github.com> | 2021-05-24 17:05:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-24 09:05:58 -0700 |
commit | 53d662a089636b8cd80df435a5df05b4cd294f93 (patch) | |
tree | ec0ea82fda8c2be72c684beff6ec578fb0f4a9ee /projects/poco | |
parent | 1adda8c603496574bbfa7e317881fd262af47bea (diff) | |
download | oss-fuzz-53d662a089636b8cd80df435a5df05b4cd294f93.tar.gz |
[poco] Initial integration (#4736)
Diffstat (limited to 'projects/poco')
-rw-r--r-- | projects/poco/Dockerfile | 23 | ||||
-rwxr-xr-x | projects/poco/build.sh | 37 | ||||
-rw-r--r-- | projects/poco/json_parse_fuzzer.cc | 32 | ||||
-rw-r--r-- | projects/poco/project.yaml | 10 |
4 files changed, 102 insertions, 0 deletions
diff --git a/projects/poco/Dockerfile b/projects/poco/Dockerfile new file mode 100644 index 000000000..913664451 --- /dev/null +++ b/projects/poco/Dockerfile @@ -0,0 +1,23 @@ +# Copyright 2021 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. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder +RUN apt-get update && apt-get install -y openssl libssl-dev git make cmake libssl-dev +RUN git clone --depth 1 -b poco-1.10.2 https://github.com/pocoproject/poco +WORKDIR $SRC/poco +COPY build.sh \ + json_parse_fuzzer.cc \ + $SRC/ diff --git a/projects/poco/build.sh b/projects/poco/build.sh new file mode 100755 index 000000000..6d0d79268 --- /dev/null +++ b/projects/poco/build.sh @@ -0,0 +1,37 @@ +#!/bin/bash -eu +# Copyright 2021 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. +# +################################################################################ + +mkdir cmake-build +cd cmake-build +cmake -DBUILD_SHARED_LIBS=OFF \ + -DENABLE_TESTS=OFF \ + .. +make -j$(nproc) + +$CXX $CXXFLAGS -DPOCO_ENABLE_CPP11 -DPOCO_ENABLE_CPP14 \ + -DPOCO_HAVE_FD_EPOLL -DPOCO_OS_FAMILY_UNIX \ + -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE \ + -D_REENTRANT -D_THREAD_SAFE -D_XOPEN_SOURCE=500 \ + -I/src/poco/JSON/include \ + -I/src/poco/Foundation/include \ + -O2 -g -DNDEBUG -std=gnu++14 \ + -o json_fuzzer.o -c $SRC/json_parse_fuzzer.cc + +$CXX $CXXFLAGS $LIB_FUZZING_ENGINE json_fuzzer.o \ + ./lib/libPocoJSON.a \ + ./lib/libPocoFoundation.a \ + -o $OUT/json_parser_fuzzer -lpthread -ldl -lrt diff --git a/projects/poco/json_parse_fuzzer.cc b/projects/poco/json_parse_fuzzer.cc new file mode 100644 index 000000000..3eab522b3 --- /dev/null +++ b/projects/poco/json_parse_fuzzer.cc @@ -0,0 +1,32 @@ +/* Copyright 2021 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 "Poco/JSON/JSON.h" +#include "Poco/JSON/ParserImpl.h" +#include "Poco/JSON/Parser.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + std::string json(reinterpret_cast<const char*>(data), size); + Poco::JSON::Parser parser; + + Poco::Dynamic::Var result; + try + { + result = parser.parse(json); + } + catch(const std::exception& e) + { + return 0; + } + return 0; +} diff --git a/projects/poco/project.yaml b/projects/poco/project.yaml new file mode 100644 index 000000000..10d989fcd --- /dev/null +++ b/projects/poco/project.yaml @@ -0,0 +1,10 @@ +homepage: "https://github.com/pocoproject/poco" +main_repo: "https://github.com/pocoproject/poco" +language: c++ +primary_contact: "guenter@pocoproject.org" +auto_ccs: + - "Adam@adalogics.com" +sanitizers: + - address + - undefined + - memory |