Coverage Report

Created: 2026-06-30 07:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/solidity/test/tools/ossfuzz/strictasm_assembly_ossfuzz.cpp
Line
Count
Source
1
/*
2
  This file is part of solidity.
3
4
  solidity is free software: you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
6
  the Free Software Foundation, either version 3 of the License, or
7
  (at your option) any later version.
8
9
  solidity is distributed in the hope that it will be useful,
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
  GNU General Public License for more details.
13
14
  You should have received a copy of the GNU General Public License
15
  along with solidity.  If not, see <http://www.gnu.org/licenses/>.
16
*/
17
// SPDX-License-Identifier: GPL-3.0
18
19
#include <libyul/YulStack.h>
20
#include <libyul/backends/evm/EVMCodeTransform.h>
21
22
#include <liblangutil/DebugInfoSelection.h>
23
#include <liblangutil/EVMVersion.h>
24
25
using namespace solidity;
26
using namespace solidity::yul;
27
28
// Prototype as we can't use the FuzzerInterface.h header.
29
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size);
30
31
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
32
17.8k
{
33
17.8k
  if (_size > 600)
34
7
    return 0;
35
36
17.8k
  YulStringRepository::reset();
37
38
17.8k
  std::string input(reinterpret_cast<char const*>(_data), _size);
39
17.8k
  YulStack stack(
40
17.8k
    langutil::EVMVersion(),
41
17.8k
    solidity::frontend::OptimiserSettings::minimal(),
42
17.8k
    langutil::DebugInfoSelection::AllExceptExperimental()
43
17.8k
  );
44
45
17.8k
  if (!stack.parseAndAnalyze("source", input))
46
8.18k
    return 0;
47
48
9.63k
  try
49
9.63k
  {
50
9.63k
    MachineAssemblyObject obj = stack.assemble(YulStack::Machine::EVM);
51
9.63k
    solAssert(obj.bytecode, "");
52
9.63k
  }
53
9.63k
  catch (StackTooDeepError const&)
54
9.63k
  {
55
56
1.06k
  }
57
58
9.63k
  return 0;
59
9.63k
}