[Solidity] Enable abiv2 proto fuzzer (#2614)

This commit is contained in:
Bhargava Shastry 2019-07-17 18:34:07 +02:00 committed by jonathanmetzman
parent 1ab23f71f4
commit 09e316afef
2 changed files with 32 additions and 1 deletions

View File

@ -22,4 +22,8 @@ RUN git clone --depth 1 https://github.com/ethereum/solidity-fuzzing-corpus.git
RUN git clone --recursive -b boost-1.69.0 https://github.com/boostorg/boost.git boost
RUN git clone --depth 1 https://github.com/google/libprotobuf-mutator.git
RUN (mkdir LPM && cd LPM && cmake ../libprotobuf-mutator -GNinja -DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON -DLIB_PROTO_MUTATOR_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/usr" && ninja && ninja install && cd external.protobuf && cp -Rf bin lib include /usr)
RUN git clone --branch="v0.1.0" --recurse-submodules https://github.com/ethereum/evmone.git
RUN git clone --branch="v0.2.0" https://github.com/chfast/intx.git
RUN git clone --branch="v0.4.4" https://github.com/chfast/ethash.git
RUN (wget https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5-Linux-x86_64.sh && chmod +x cmake-3.14.5-Linux-x86_64.sh && mkdir -p /src/cmake-3.14.5 && ./cmake-3.14.5-Linux-x86_64.sh --skip-license --prefix="/src/cmake-3.14.5")
COPY build.sh $SRC/

View File

@ -25,11 +25,38 @@ cd $SRC/boost
system regex filesystem unit_test_framework program_options \
install -j $(($(nproc)/2))
# Newer cmake version required for evmone
CMAKE_NEW=${SRC}/cmake-3.14.5/bin/cmake
# Instrument evmone and dependencies
cd $SRC/ethash
mkdir -p build
cd build
$CMAKE_NEW .. -G Ninja -DBUILD_SHARED_LIBS=OFF -DETHASH_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX="/usr"
ninja
ninja install
cd $SRC/intx
mkdir -p build
cd build
$CMAKE_NEW .. -G Ninja -DBUILD_SHARED_LIBS=OFF -DINTX_TESTING=OFF -DINTX_BENCHMARKING=OFF -DCMAKE_INSTALL_PREFIX="/usr"
ninja
ninja install
cd $SRC/evmone
mkdir -p build
cd build
$CMAKE_NEW .. -G Ninja -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="/usr"
ninja
ninja install
# Compile proto C++ bindings
protoc \
--proto_path=$SRC/solidity/test/tools/ossfuzz yulProto.proto \
--cpp_out=$SRC/solidity/test/tools/ossfuzz
protoc \
--proto_path=$SRC/solidity/test/tools/ossfuzz abiV2Proto.proto \
--cpp_out=$SRC/solidity/test/tools/ossfuzz
# Build solidity
cd $SRC/solidity
@ -57,7 +84,7 @@ cmake -DUSE_Z3=OFF -DUSE_CVC4=OFF -DOSSFUZZ=ON \
-DBoost_UNIT_TEST_FRAMEWORK_LIBRARY=/usr/local/lib/libboost_unit_test_framework.a \
-DBoost_UNIT_TEST_FRAMEWORK_LIBRARIES=/usr/local/lib/libboost_unit_test_framework.a \
$SRC/solidity
make ossfuzz ossfuzz_proto -j $(nproc)
make ossfuzz ossfuzz_proto ossfuzz_abiv2 -j $(nproc)
# Copy fuzzer binary, seed corpus, fuzzer options, and dictionary
cp test/tools/ossfuzz/*_ossfuzz $OUT/