mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11416 from ethereum/fix-asan-stack-use-after-scope-in-test-file-parser-test
Fix asan stack-use-after-scope in TestFileParserTest
This commit is contained in:
commit
1239c0c332
@ -726,7 +726,7 @@ char TestFileParser::Scanner::scanHexPart()
|
||||
return static_cast<char>(value);
|
||||
}
|
||||
|
||||
bool TestFileParser::isBuiltinFunction(std::string const& signature)
|
||||
bool TestFileParser::isBuiltinFunction(std::string const& _signature)
|
||||
{
|
||||
return m_builtins.count(signature) > 0;
|
||||
return m_builtins.count(_signature) > 0;
|
||||
}
|
||||
|
@ -52,7 +52,10 @@ class TestFileParser
|
||||
public:
|
||||
/// Constructor that takes an input stream \param _stream to operate on
|
||||
/// and creates the internal scanner.
|
||||
explicit TestFileParser(std::istream& _stream, std::map<std::string, Builtin> const& _builtins): m_scanner(_stream), m_builtins(_builtins) {}
|
||||
explicit TestFileParser(std::istream& _stream, std::map<std::string, Builtin> const& _builtins):
|
||||
m_scanner(_stream),
|
||||
m_builtins(_builtins)
|
||||
{}
|
||||
|
||||
/// Parses function calls blockwise and returns a list of function calls found.
|
||||
/// Throws an exception if a function call cannot be parsed because of its
|
||||
@ -179,7 +182,7 @@ private:
|
||||
|
||||
/// Checks whether a builtin function with the given signature exist.
|
||||
/// @returns true, if builtin found, false otherwise
|
||||
bool isBuiltinFunction(std::string const& signature);
|
||||
bool isBuiltinFunction(std::string const& _signature);
|
||||
|
||||
/// A scanner instance
|
||||
Scanner m_scanner;
|
||||
|
@ -44,9 +44,10 @@ namespace
|
||||
|
||||
vector<FunctionCall> parse(string const& _source)
|
||||
{
|
||||
static std::map<std::string, Builtin> const builtins = {};
|
||||
|
||||
istringstream stream{_source, ios_base::out};
|
||||
TestFileParser parser{stream, {}};
|
||||
return parser.parseFunctionCalls(0);
|
||||
return TestFileParser{stream, builtins}.parseFunctionCalls(0);
|
||||
}
|
||||
|
||||
void testFunctionCall(
|
||||
@ -99,7 +100,7 @@ BOOST_AUTO_TEST_CASE(smoke_test)
|
||||
BOOST_REQUIRE_EQUAL(parse(source).size(), 0);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(call_succees)
|
||||
BOOST_AUTO_TEST_CASE(call_success)
|
||||
{
|
||||
char const* source = R"(
|
||||
// success() ->
|
||||
|
Loading…
Reference in New Issue
Block a user