GNU multiprecision (libgmp) fuzzer (#1587)

* Build OpenSSL+libgmp fuzzer

* Fix comment typo
This commit is contained in:
Guido Vranken 2018-07-03 18:51:01 +02:00 committed by Kostya Serebryany
parent 12982882b8
commit 422df7dab4
2 changed files with 23 additions and 1 deletions

View File

@ -16,7 +16,7 @@
FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER guidovranken@gmail.com
RUN apt-get update && apt-get install -y software-properties-common python-software-properties wget curl sudo libboost-all-dev
RUN apt-get update && apt-get install -y software-properties-common python-software-properties wget curl sudo mercurial autoconf bison texinfo libboost-all-dev
RUN add-apt-repository -y ppa:gophers/archive && apt-get update && apt-get install -y golang-1.9-go
RUN ln -s /usr/lib/go-1.9/bin/go /usr/bin/go
@ -25,4 +25,5 @@ RUN curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly
RUN git clone --depth 1 https://github.com/guidovranken/bignum-fuzzer
RUN git clone --depth 1 https://github.com/openssl/openssl
RUN hg clone https://gmplib.org/repo/gmp/ libgmp/
COPY build.sh $SRC/

View File

@ -6,6 +6,12 @@ fi
./config
make -j$(nproc)
# Build libgmp
cd $SRC/libgmp
autoreconf -ivf
./configure --enable-maintainer-mode
make -j$(nproc)
# Build OpenSSL module
cd $SRC/bignum-fuzzer/modules/openssl
OPENSSL_INCLUDE_PATH=$SRC/openssl/include OPENSSL_LIBCRYPTO_A_PATH=$SRC/openssl/libcrypto.a make
@ -22,6 +28,10 @@ make
cd $SRC/bignum-fuzzer/modules/cpp_boost
make
# Build libgmp module
cd $SRC/bignum-fuzzer/modules/libgmp
LIBGMP_INCLUDE_PATH=$SRC/libgmp LIBGMP_A_PATH=$SRC/libgmp/.libs/libgmp.a make
BASE_CXXFLAGS=$CXXFLAGS
# Build OpenSSL/Go fuzzer
@ -53,7 +63,18 @@ LIBFUZZER_LINK="-lFuzzingEngine" make
# Copy OpenSSL/C++-Boost fuzzer to the designated location
cp $SRC/bignum-fuzzer/fuzzer $OUT/fuzzer_openssl_cpp_boost_num_len_1200_all_operations_num_loops_1
# Build OpenSSL/libgmp fuzzer
cd $SRC/bignum-fuzzer
make clean
./config-modules.sh openssl libgmp
CXXFLAGS="$BASE_CXXFLAGS -DBNFUZZ_FLAG_NUM_LEN=1200 -DBNFUZZ_FLAG_ALL_OPERATIONS=1 -DBNFUZZ_FLAG_NUM_LOOPS=1"
LIBFUZZER_LINK="-lFuzzingEngine" make
# Copy OpenSSL/libgmp fuzzer to the designated location
cp $SRC/bignum-fuzzer/fuzzer $OUT/fuzzer_openssl_libgmp_num_len_1200_all_operations_num_loops_1
# Copy seed corpora to the designated location
cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_go_no_negative_num_len_1200_all_operations_seed_corpus.zip $OUT
cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_rust_num_len_1200_all_operations_num_loops_1_seed_corpus.zip $OUT
cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_cpp_boost_num_len_1200_all_operations_num_loops_1_seed_corpus.zip $OUT
cp $SRC/bignum-fuzzer/corpora/fuzzer_openssl_libgmp_num_len_1200_all_operations_num_loops_1_seed_corpus.zip $OUT