Skip to content

Commit

Permalink
yaml-cpp: initial integration
Browse files Browse the repository at this point in the history
  • Loading branch information
initializedd committed Dec 14, 2024
1 parent ecfd462 commit a436fb1
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
29 changes: 29 additions & 0 deletions projects/yaml-cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2024 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 \
cmake

RUN git clone --depth 1 https://github.com/jbeder/yaml-cpp.git $SRC/yaml-cpp/
RUN git clone --depth 1 https://github.com/initializedd/yaml-cpp-fuzzer.git $SRC/yaml-cpp-fuzzer/

COPY build.sh $SRC/
WORKDIR $SRC/yaml-cpp/

38 changes: 38 additions & 0 deletions projects/yaml-cpp/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash -eu

# Copyright 2024 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 -p build
cd build

cmake -DUPDATE_DEPS=ON -DCMAKE_BUILD_TYPE=Release ..
make -j4

cp $SRC/yaml-cpp-fuzzer/*.dict $OUT/
cp $SRC/yaml-cpp-fuzzer/*.options $OUT/

for fuzzer in $(find $SRC/yaml-cpp-fuzzer/ -name "*_fuzzer.cpp"); do
fuzzer_basename=$(basename -s .cpp $fuzzer)
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE \
-I$SRC/yaml-cpp/include \
$fuzzer \
-o $OUT/$fuzzer_basename \
libyaml-cpp.a

zip -q $OUT/${fuzzer_basename}_seed_corpus.zip $SRC/yaml-cpp-fuzzer/${fuzzer_basename}_seed_corpus/*
done

5 changes: 5 additions & 0 deletions projects/yaml-cpp/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
homepage: "https://codedocs.xyz/jbeder/yaml-cpp/index.html"
main_repo: "https://github.com/jbeder/yaml-cpp"
language: c++
primary_contact: "[email protected]"

0 comments on commit a436fb1

Please sign in to comment.