Coverage Report

Created: 2025-09-04 07:34

/src/solidity/test/tools/ossfuzz/const_opt_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 <test/tools/fuzzer_common.h>
20
21
// Prototype as we can't use the FuzzerInterface.h header.
22
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size);
23
24
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
25
2.41k
{
26
2.41k
  if (_size <= 250)
27
2.40k
  {
28
2.40k
    std::string input(reinterpret_cast<char const*>(_data), _size);
29
2.40k
    FuzzerUtil::testConstantOptimizer(input, /*quiet=*/true);
30
2.40k
  }
31
2.41k
  return 0;
32
2.41k
}