1#!/bin/bash -eu 2# Copyright 2016 Google Inc. 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 18mkdir bld 19cd bld 20 21export ASAN_OPTIONS=detect_leaks=0 22 23# Limit max length of data blobs and sql queries to prevent irrelevant OOMs. 24# Also limit max memory page count to avoid creating large databases. 25export CFLAGS="$CFLAGS -DSQLITE_MAX_LENGTH=128000000 \ 26 -DSQLITE_MAX_SQL_LENGTH=128000000 \ 27 -DSQLITE_MAX_MEMORY=25000000 \ 28 -DSQLITE_PRINTF_PRECISION_LIMIT=1048576 \ 29 -DSQLITE_DEBUG=1 \ 30 -DSQLITE_MAX_PAGE_COUNT=16384" 31 32../configure 33make -j$(nproc) 34make sqlite3.c 35 36$CC $CFLAGS -I. -c \ 37 $SRC/sqlite3/test/ossfuzz.c -o $SRC/sqlite3/test/ossfuzz.o 38 39$CXX $CXXFLAGS \ 40 $SRC/sqlite3/test/ossfuzz.o -o $OUT/ossfuzz \ 41 $LIB_FUZZING_ENGINE ./sqlite3.o 42 43cp $SRC/*.options $SRC/*.dict $SRC/*.zip $OUT/ 44