Disallowing usage of msg.data in receive() function.

This commit is contained in:
Djordje Mijovic
2020-12-08 11:49:20 +01:00
parent 4368a3b3eb
commit acb93f3a97
3 changed files with 17 additions and 0 deletions
+11
View File
@@ -224,6 +224,17 @@ bool StaticAnalyzer::visit(MemberAccess const& _memberAccess)
"Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode."
);
}
else if (
m_currentFunction &&
m_currentFunction->isReceive() &&
type->kind() == MagicType::Kind::Message &&
_memberAccess.memberName() == "data"
)
m_errorReporter.typeError(
7139_error,
_memberAccess.location(),
R"("msg.data" cannot be used inside of "receive" function.)"
);
}
if (_memberAccess.memberName() == "callcode")