xref: /aosp_15_r20/external/libxaac/fuzzer/ossfuzz.sh (revision 15dc779a375ca8b5125643b829a8aa4b70d7f451)
1*15dc779aSAndroid Build Coastguard Worker#!/bin/bash -eu
2*15dc779aSAndroid Build Coastguard Worker#
3*15dc779aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*15dc779aSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*15dc779aSAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*15dc779aSAndroid Build Coastguard Worker#
7*15dc779aSAndroid Build Coastguard Worker#      http://www.apache.org/licenses/LICENSE-2.0
8*15dc779aSAndroid Build Coastguard Worker#
9*15dc779aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*15dc779aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*15dc779aSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*15dc779aSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*15dc779aSAndroid Build Coastguard Worker# limitations under the License.
14*15dc779aSAndroid Build Coastguard Worker#
15*15dc779aSAndroid Build Coastguard Worker################################################################################
16*15dc779aSAndroid Build Coastguard Worker# Ensure SRC and WORK are set
17*15dc779aSAndroid Build Coastguard Workertest "${SRC}" != "" || exit 1
18*15dc779aSAndroid Build Coastguard Workertest "${WORK}" != "" || exit 1
19*15dc779aSAndroid Build Coastguard Worker
20*15dc779aSAndroid Build Coastguard Worker#Opt out of shift sanitizer in undefined sanitizer
21*15dc779aSAndroid Build Coastguard Workerif [[ $SANITIZER = *undefined* ]]; then
22*15dc779aSAndroid Build Coastguard Worker  CFLAGS="$CFLAGS -fno-sanitize=shift"
23*15dc779aSAndroid Build Coastguard Worker  CXXFLAGS="$CXXFLAGS -fno-sanitize=shift"
24*15dc779aSAndroid Build Coastguard Workerfi
25*15dc779aSAndroid Build Coastguard Worker
26*15dc779aSAndroid Build Coastguard Worker# Build libxaac
27*15dc779aSAndroid Build Coastguard Workerbuild_dir=$WORK/build
28*15dc779aSAndroid Build Coastguard Workerrm -rf ${build_dir}
29*15dc779aSAndroid Build Coastguard Workermkdir -p ${build_dir}
30*15dc779aSAndroid Build Coastguard Workerpushd ${build_dir}
31*15dc779aSAndroid Build Coastguard Worker
32*15dc779aSAndroid Build Coastguard Workercmake $SRC/libxaac
33*15dc779aSAndroid Build Coastguard Workermake -j$(nproc) xaac_dec_fuzzer xaac_enc_fuzzer
34*15dc779aSAndroid Build Coastguard Workercp ${build_dir}/xaac_dec_fuzzer $OUT/
35*15dc779aSAndroid Build Coastguard Workercp ${build_dir}/xaac_enc_fuzzer $OUT/
36*15dc779aSAndroid Build Coastguard Workerpopd
37*15dc779aSAndroid Build Coastguard Worker
38*15dc779aSAndroid Build Coastguard Workercp $SRC/libxaac/fuzzer/xaac_dec_fuzzer.dict $OUT/
39*15dc779aSAndroid Build Coastguard Workercp $SRC/libxaac/fuzzer/xaac_enc_fuzzer.dict $OUT/
40