• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eu
2# Copyright 2021 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17
18# Added to fix a false positive result: https://github.com/google/oss-fuzz/issues/6489
19CXXFLAGS="${CXXFLAGS} -fno-sanitize=float-divide-by-zero"
20
21# Build Exiv2
22mkdir -p build
23cd build
24cmake -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=OFF -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXIV2_BUILD_FUZZ_TESTS=ON -DEXIV2_TEAM_OSS_FUZZ=ON -DLIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE}" ..
25make -j $(nproc)
26
27# Copy binary and dictionary to $OUT
28cp ./bin/fuzz-read-print-write $OUT
29cp ../fuzz/exiv2.dict $OUT/fuzz-read-print-write.dict
30
31# Initialize the corpus, using the files in test/data
32mkdir corpus
33for f in $(find ../test/data -type f -size -20k); do
34    s=$(sha1sum "$f" | awk '{print $1}')
35    cp $f corpus/$s
36done
37
38zip -j $OUT/fuzz-read-print-write.zip corpus/*
39