diff options
author | 2021-05-05 22:04:18 +0100 | |
---|---|---|
committer | 2021-05-05 17:04:18 -0400 | |
commit | 608d4c0960d7a30a544e515306c6e1b45fd1528f (patch) | |
tree | 9c2a93a91333d7ff67453eea4d269e059fd2a02a /projects/oatpp | |
parent | 536d21b4dad60d7eb608d7e424d776587fcfd104 (diff) |
oatpp: initial integration. (#5689)
* oatpp: initial integration.
Diffstat (limited to 'projects/oatpp')
-rw-r--r-- | projects/oatpp/Dockerfile | 22 | ||||
-rwxr-xr-x | projects/oatpp/build.sh | 22 | ||||
-rw-r--r-- | projects/oatpp/fuzz_mapper.cpp | 40 | ||||
-rw-r--r-- | projects/oatpp/project.yaml | 6 |
4 files changed, 90 insertions, 0 deletions
diff --git a/projects/oatpp/Dockerfile b/projects/oatpp/Dockerfile new file mode 100644 index 00000000..daeab9cc --- /dev/null +++ b/projects/oatpp/Dockerfile @@ -0,0 +1,22 @@ +# 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 make autoconf automake libtool +RUN git clone --depth 1 https://github.com/oatpp/oatpp.git oatpp +WORKDIR oatpp +COPY build.sh $SRC/ +COPY fuzz_mapper.cpp $SRC/ diff --git a/projects/oatpp/build.sh b/projects/oatpp/build.sh new file mode 100755 index 00000000..18e55d05 --- /dev/null +++ b/projects/oatpp/build.sh @@ -0,0 +1,22 @@ +#!/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 build && cd build +cmake ../ +make +$CXX $CXXFLAGS $LIB_FUZZING_ENGINE $SRC/fuzz_mapper.cpp -o $OUT/fuzz_mapper \ + ./src/liboatpp.a -I../src diff --git a/projects/oatpp/fuzz_mapper.cpp b/projects/oatpp/fuzz_mapper.cpp new file mode 100644 index 00000000..c26e727d --- /dev/null +++ b/projects/oatpp/fuzz_mapper.cpp @@ -0,0 +1,40 @@ +/* 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. +*/ + +#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp/core/macro/codegen.hpp" + +typedef oatpp::parser::Caret ParsingCaret; +typedef oatpp::parser::json::mapping::Serializer Serializer; +typedef oatpp::parser::json::mapping::Deserializer Deserializer; + +#include OATPP_CODEGEN_BEGIN(DTO) + +class EmptyDto : public oatpp::DTO { + DTO_INIT(EmptyDto, DTO) +}; + + +class Test1 : public oatpp::DTO { + DTO_INIT(Test1, DTO) + DTO_FIELD(String, strF); +}; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + oatpp::String input(reinterpret_cast<const char*>(data), size, true); + oatpp::parser::json::mapping::ObjectMapper mapper; + try { + mapper.readFromString<oatpp::Object<Test1>>(input); + } catch(...) {} + + return 0; +} diff --git a/projects/oatpp/project.yaml b/projects/oatpp/project.yaml new file mode 100644 index 00000000..1815f0f7 --- /dev/null +++ b/projects/oatpp/project.yaml @@ -0,0 +1,6 @@ +homepage: "https://oatpp.io/" +language: c++ +primary_contact: "bugs@oatpp.io" +main_repo: "https://github.com/oatpp/oatpp" +auto_ccs: + - "david@adalogics.com" |