diff --git a/test/tools/ossfuzz/SolidityGenerator.cpp b/test/tools/ossfuzz/SolidityGenerator.cpp index 52c35513e..03dc5c97e 100644 --- a/test/tools/ossfuzz/SolidityGenerator.cpp +++ b/test/tools/ossfuzz/SolidityGenerator.cpp @@ -303,7 +303,9 @@ string BlockStmtGenerator::visit() return "\n"; incrementNestingDepth(); ostringstream block; - block << indentation() + "{\n"; + // Make block unchecked with a small probability + bool unchecked = uRandDist->probable(s_uncheckedInvProb); + block << indentation() + (unchecked ? "unchecked " : "") + "{\n"; state->indent(); block << visitChildren(); state->unindent(); diff --git a/test/tools/ossfuzz/SolidityGenerator.h b/test/tools/ossfuzz/SolidityGenerator.h index 5fd4a6488..68e48bdba 100644 --- a/test/tools/ossfuzz/SolidityGenerator.h +++ b/test/tools/ossfuzz/SolidityGenerator.h @@ -876,6 +876,7 @@ private: size_t m_nestingDepth; static constexpr unsigned s_maxStatements = 4; static constexpr unsigned s_maxNestingDepth = 3; + static constexpr size_t s_uncheckedInvProb = 13; }; class SolidityGenerator: public std::enable_shared_from_this