diff --git a/test/tools/ossfuzz/SolidityEvmoneInterface.h b/test/tools/ossfuzz/SolidityEvmoneInterface.h index 201d844b3..3b576fc27 100644 --- a/test/tools/ossfuzz/SolidityEvmoneInterface.h +++ b/test/tools/ossfuzz/SolidityEvmoneInterface.h @@ -109,6 +109,10 @@ public: { m_compilerInput.optimiserSettings = _opt; } + void viaIR(bool _viaIR) + { + m_compilerInput.viaIR = _viaIR; + } void reset(bool _keepSettings) { m_compiler.reset(_keepSettings); @@ -178,6 +182,10 @@ public: { m_compilationFramework.optSetting(_opt); } + void viaIR(bool _viaIR) + { + m_compilationFramework.viaIR(_viaIR); + } /// @returns the result of the execution of the function whose /// keccak256 hash is @param _functionHash that is deployed at diff --git a/test/tools/ossfuzz/solc_ossfuzz.cpp b/test/tools/ossfuzz/solc_ossfuzz.cpp index ab4290428..929e526c1 100644 --- a/test/tools/ossfuzz/solc_ossfuzz.cpp +++ b/test/tools/ossfuzz/solc_ossfuzz.cpp @@ -22,10 +22,12 @@ #include -#include +#include #include +#include + #include using namespace solidity::frontend::test; @@ -112,18 +114,10 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) compilerSetting.runYulOptimiser = true; compilerSetting.optimizeStackAllocation = true; - CompilerInput cInputOpt = { - version, - sourceCode, - contractName, - compilerSetting, - {}, - false, - true - }; hostContext.reset(); evmoneUtil.reset(true); evmoneUtil.optSetting(compilerSetting); + evmoneUtil.viaIR(true); auto compilerOutputOpt = evmoneUtil.compileContract(); solAssert(compilerOutputOpt.has_value(), "Contract could not be optimised."); @@ -162,6 +156,10 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) { return 0; } + catch (solidity::yul::StackTooDeepError const&) + { + return 0; + } } return 0; }