Merge pull request #9082 from ethereum/conversionWarnings

Adding `-Wsign-conversion` flag and fixing errors
This commit is contained in:
chriseth
2020-07-13 11:28:09 +02:00
committed by GitHub
16 changed files with 30 additions and 24 deletions
+5
View File
@@ -8,6 +8,7 @@ add_dependencies(ossfuzz
strictasm_assembly_ossfuzz
)
if (OSSFUZZ)
add_custom_target(ossfuzz_proto)
add_dependencies(ossfuzz_proto
@@ -54,6 +55,7 @@ if (OSSFUZZ)
protobuf.a
)
set_target_properties(yul_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
target_compile_options(yul_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
add_executable(yul_proto_diff_ossfuzz yulProto_diff_ossfuzz.cpp yulFuzzerCommon.cpp protoToYul.cpp yulProto.pb.cc)
target_include_directories(yul_proto_diff_ossfuzz PRIVATE /usr/include/libprotobuf-mutator)
@@ -64,6 +66,7 @@ if (OSSFUZZ)
protobuf.a
)
set_target_properties(yul_proto_diff_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
target_compile_options(yul_proto_diff_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
add_executable(yul_proto_diff_custom_mutate_ossfuzz
yulProto_diff_ossfuzz.cpp
@@ -99,6 +102,7 @@ if (OSSFUZZ)
protobuf.a
)
set_target_properties(abiv2_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
target_compile_options(abiv2_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
add_executable(sol_proto_ossfuzz
solProtoFuzzer.cpp
@@ -118,6 +122,7 @@ if (OSSFUZZ)
protobuf.a
)
set_target_properties(sol_proto_ossfuzz PROPERTIES LINK_FLAGS ${LIB_FUZZING_ENGINE})
target_compile_options(sol_proto_ossfuzz PUBLIC ${COMPILE_OPTIONS} -Wno-sign-conversion)
else()
add_library(solc_opt_ossfuzz
solc_opt_ossfuzz.cpp
+2 -2
View File
@@ -192,13 +192,13 @@ void ProtoConverter::visit(VarRef const& _x)
{
// Ensure that there is at least one variable declaration to reference in function scope.
yulAssert(m_currentFuncVars.size() > 0, "Proto fuzzer: No variables to reference.");
m_output << *m_currentFuncVars[_x.varnum() % m_currentFuncVars.size()];
m_output << *m_currentFuncVars[static_cast<size_t>(_x.varnum()) % m_currentFuncVars.size()];
}
else
{
// Ensure that there is at least one variable declaration to reference in nested scopes.
yulAssert(m_currentGlobalVars.size() > 0, "Proto fuzzer: No global variables to reference.");
m_output << *m_currentGlobalVars[_x.varnum() % m_currentGlobalVars.size()];
m_output << *m_currentGlobalVars[static_cast<size_t>(_x.varnum()) % m_currentGlobalVars.size()];
}
}
+1 -1
View File
@@ -202,7 +202,7 @@ DEFINE_PROTO_FUZZER(Program const& _input)
// With libFuzzer binary run this to generate a YUL source file x.yul:
// PROTO_FUZZER_DUMP_PATH=x.yul ./a.out proto-input
ofstream of(dump_path);
of.write(sol_source.data(), sol_source.size());
of.write(sol_source.data(), static_cast<streamsize>(sol_source.size()));
}
if (char const* dump_path = getenv("SOL_DEBUG_FILE"))
+1 -1
View File
@@ -43,7 +43,7 @@ DEFINE_PROTO_FUZZER(Program const& _input)
// With libFuzzer binary run this to generate a YUL source file x.yul:
// PROTO_FUZZER_DUMP_PATH=x.yul ./a.out proto-input
ofstream of(dump_path);
of.write(yul_source.data(), yul_source.size());
of.write(yul_source.data(), static_cast<streamsize>(yul_source.size()));
}
if (yul_source.size() > 1200)
+1 -1
View File
@@ -64,7 +64,7 @@ DEFINE_PROTO_FUZZER(Program const& _input)
// With libFuzzer binary run this to generate a YUL source file x.yul:
// PROTO_FUZZER_DUMP_PATH=x.yul ./a.out proto-input
ofstream of(dump_path);
of.write(yul_source.data(), yul_source.size());
of.write(yul_source.data(), static_cast<streamsize>(yul_source.size()));
}
YulStringRepository::reset();