Skip to content

Commit

Permalink
Merge pull request #392 from chriseth/fixsegfault
Browse files Browse the repository at this point in the history
Fixsegfault
  • Loading branch information
chriseth committed Feb 13, 2016
2 parents c6c3c78 + 4a83716 commit a14185a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libsolidity/analysis/TypeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ void TypeChecker::visitManually(
return;
}
if (parameters->size() != arguments.size())
{
typeError(
_modifier.location(),
"Wrong argument count for modifier invocation: " +
Expand All @@ -512,6 +513,8 @@ void TypeChecker::visitManually(
toString(parameters->size()) +
"."
);
return;
}
for (size_t i = 0; i < _modifier.arguments().size(); ++i)
if (!type(*arguments[i])->isImplicitlyConvertibleTo(*type(*(*parameters)[i])))
typeError(
Expand Down
15 changes: 15 additions & 0 deletions test/libsolidity/SolidityNameAndTypeResolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3136,6 +3136,21 @@ BOOST_AUTO_TEST_CASE(conditional_with_all_types)
BOOST_CHECK(success(text));
}

BOOST_AUTO_TEST_CASE(constructor_call_invalid_arg_count)
{
// This caused a segfault in an earlier version
char const* text = R"(
contract C {
function C(){}
}
contract D is C {
function D() C(5){}
}
)";

BOOST_CHECK(expectError(text) == Error::Type::TypeError);
}

BOOST_AUTO_TEST_CASE(index_access_for_bytes)
{
char const* text = R"(
Expand Down

0 comments on commit a14185a

Please sign in to comment.