Skip to content

Commit

Permalink
Add fuzzing targets for ReadStat (#2093)
Browse files Browse the repository at this point in the history
* Add ReadStat project

* Add fuzzing targets for new project ReadStat

Adding fuzzers for six file formats supported by ReadStat. A corpus
is generated in each case from example data in the test suite.

Tested locally on Linux, which check_build passing in all six cases.
  • Loading branch information
evanmiller authored and inferno-chromium committed Jan 18, 2019
1 parent c545039 commit d517d05
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
23 changes: 23 additions & 0 deletions projects/readstat/Dockerfile
@@ -0,0 +1,23 @@
# Copyright 2019 Evan Miller
#
# 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.
#
################################################################################

FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER emmiller@gmail.com
RUN apt-get update && apt-get install -y make autoconf automake libtool zip zlib1g-dev

RUN git clone --depth 1 https://github.com/WizardMac/ReadStat readstat
WORKDIR readstat
COPY build.sh $SRC/
45 changes: 45 additions & 0 deletions projects/readstat/build.sh
@@ -0,0 +1,45 @@
# Copyright 2019 Evan Miller
#
# 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.
#
################################################################################

#!/bin/bash -eu

./autogen.sh
./configure --enable-static
make clean

make
make generate_corpus
./generate_corpus

zip $OUT/fuzz_format_dta_seed_corpus.zip corpus/dta*/test-case-*
zip $OUT/fuzz_format_por_seed_corpus.zip corpus/por/test-case-*
zip $OUT/fuzz_format_sav_seed_corpus.zip corpus/sav*/test-case-* corpus/zsav/test-case-*
zip $OUT/fuzz_format_sas7bcat_seed_corpus.zip corpus/sas7bcat/test-case-*
zip $OUT/fuzz_format_sas7bdat_seed_corpus.zip corpus/sas7bdat*/test-case-*
zip $OUT/fuzz_format_xport_seed_corpus.zip corpus/xpt*/test-case-*

READSTAT_FUZZERS="
fuzz_format_dta \
fuzz_format_por \
fuzz_format_sav \
fuzz_format_sas7bcat \
fuzz_format_sas7bdat \
fuzz_format_xport"

for fuzzer in $READSTAT_FUZZERS; do
make ${fuzzer}
cp ${fuzzer} $OUT/${fuzzer}
done

0 comments on commit d517d05

Please sign in to comment.