aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Essick <essick@google.com>2019-10-02 21:21:49 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-10-02 21:21:49 -0700
commit91cda5a80b626968b75242ba963bf351aec121d6 (patch)
tree8e21a2b5f5b945f5a92e104b63d2aea785a318f5
parent44ba49e2ed9cfec874580a6622bbea2e616a78a7 (diff)
parentfbcad2ab1bd8229e95f5ea9d578701247dd8c38c (diff)
downloadlibhevc-91cda5a80b626968b75242ba963bf351aec121d6.tar.gz
Merge "fuzzer: Create ossfuzz.sh to build with oss-fuzz"
am: fbcad2ab1b Change-Id: Ifdb939c967b83db606e7150809452cbbaf574567
-rwxr-xr-xfuzzer/ossfuzz.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/fuzzer/ossfuzz.sh b/fuzzer/ossfuzz.sh
new file mode 100755
index 0000000..dc5683c
--- /dev/null
+++ b/fuzzer/ossfuzz.sh
@@ -0,0 +1,44 @@
+#!/bin/bash -eu
+#
+# 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.
+#
+################################################################################
+# Ensure SRC and WORK are set
+test "${SRC}" != "" || exit 1
+test "${WORK}" != "" || exit 1
+test "${OUT}" != "" || exit 1
+
+# Build libhevc
+build_dir=$WORK/build
+rm -rf ${build_dir}
+mkdir -p ${build_dir}
+pushd ${build_dir}
+
+cmake $SRC/libhevc
+make -j$(nproc)
+popd
+
+# build fuzzers
+$CXX $CXXFLAGS -std=c++11 \
+-I$SRC/libhevc \
+-I$SRC/libhevc/common \
+-I$SRC/libhevc/decoder \
+-I${build_dir} \
+-Wl,--start-group \
+$LIB_FUZZING_ENGINE \
+$SRC/libhevc/fuzzer/hevc_dec_fuzzer.cpp -o $OUT/hevc_dec_fuzzer \
+${build_dir}/libhevcdec.a \
+-Wl,--end-group
+
+cp $SRC/hevc_dec_fuzzer_seed_corpus.zip $OUT/hevc_dec_fuzzer_seed_corpus.zip
+cp $SRC/libhevc/fuzzer/hevc_dec_fuzzer.dict $OUT/hevc_dec_fuzzer.dict