diff options
author | Ray Essick <essick@google.com> | 2019-10-02 21:30:58 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-10-02 21:30:58 -0700 |
commit | 83bf32d8b458357a5ffc4c228469f87ae76c619e (patch) | |
tree | e418d7b37688a36e17ea55bed225d1b4e837e2e1 | |
parent | 56335db9bbf5ff1b4fffde816e35dc01f9d458ee (diff) | |
parent | 185d891f1c282732584f5dbfed224ddefe864cc6 (diff) | |
download | libmpeg2-83bf32d8b458357a5ffc4c228469f87ae76c619e.tar.gz |
Merge "fuzzer: Create ossfuzz.sh to build with oss-fuzz" am: 6891249c9c
am: 185d891f1c
Change-Id: Ic139632e03bcf85c861dd9649a41a50161658a70
-rwxr-xr-x | fuzzer/ossfuzz.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/fuzzer/ossfuzz.sh b/fuzzer/ossfuzz.sh new file mode 100755 index 0000000..3493031 --- /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 libmpeg2 +build_dir=$WORK/build +rm -rf ${build_dir} +mkdir -p ${build_dir} +pushd ${build_dir} + +cmake $SRC/libmpeg2 +make -j$(nproc) +popd + +# build fuzzers +$CXX $CXXFLAGS -std=c++11 \ +-I$SRC/libmpeg2 \ +-I$SRC/libmpeg2/common \ +-I$SRC/libmpeg2/decoder \ +-I${build_dir} \ +-Wl,--start-group \ +$LIB_FUZZING_ENGINE \ +$SRC/libmpeg2/fuzzer/mpeg2_dec_fuzzer.cpp -o $OUT/mpeg2_dec_fuzzer \ +${build_dir}/libmpeg2dec.a \ +-Wl,--end-group + +cp $SRC/mpeg2_dec_fuzzer_seed_corpus.zip $OUT/mpeg2_dec_fuzzer_seed_corpus.zip +cp $SRC/libmpeg2/fuzzer/mpeg2_dec_fuzzer.dict $OUT/mpeg2_dec_fuzzer.dict |