Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solProtoFuzzer of OSSFUZZ can not generate different solidity program #15066

Open
Subway2023 opened this issue Apr 29, 2024 · 1 comment
Open
Labels

Comments

@Subway2023
Copy link

Description

I added code in solProtoFuzzer.cpp to output the Solidity program each time, but I found that each outputted program is the same.

Environment

  • Compiler version: 0.8.25
  • Target EVM version (as per compiler settings): None
  • Framework/IDE (e.g. Truffle or Remix): None
  • EVM execution environment / backend / blockchain client: None
  • Operating system: Linux

Steps to Reproduce

DEFINE_PROTO_FUZZER(Program const& _input)
{
	ProtoConverter converter;
	string sol_source = converter.protoToSolidity(_input);

	// ·········································································
        auto now = std::chrono::system_clock::now();
        std::time_t now_c = std::chrono::system_clock::to_time_t(now);
        std::tm localTime = *std::localtime(&now_c);
        std::ostringstream oss;
        oss << std::put_time(&localTime, "%Y%m%d-%H%M%S");

	std::hash<std::string> hasher;
	size_t hashValue = hasher(sol_source);
	std::string hashString = std::to_string(hashValue);
	
	std::string dump_path_string="/mnt/sdd1/solProtoFuzzer/"+hashString+"_"+oss.str()+".sol";
	ofstream of(dump_path_string.c_str());
	of.write(sol_source.data(), static_cast<streamsize>(sol_source.size()));
	// ············································································

However, I found that all the generated programs are the same, as follows.

pragma solidity >=0.0;


contract C {
	function test() public returns (uint)
	{
		return 0;
	}
}
@bshastry
Copy link
Contributor

This is correct. At the time, the idea was to merge boiler plate code that would eventually expand to different generators for the solidity language. But the latter is mostly code that has been unmerged unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants