mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Enforce non-empty data section
This commit is contained in:
parent
1499bf7b59
commit
8a1bbf1345
@ -774,10 +774,15 @@ LinkerObject const& Assembly::assemble() const
|
||||
toBigEndian(ret.bytecode.size(), r);
|
||||
}
|
||||
|
||||
auto const dataLength = ret.bytecode.size() - dataStart;
|
||||
auto dataLength = ret.bytecode.size() - dataStart;
|
||||
if (m_eofVersion.has_value())
|
||||
{
|
||||
assertThrow(/*dataLength >= 0 && */ dataLength <= 0xffff, AssemblyException, "Invalid data section size.");
|
||||
if (dataLength == 0)
|
||||
{
|
||||
ret.bytecode.push_back(0);
|
||||
dataLength++;
|
||||
}
|
||||
assertThrow(dataLength > 0u && dataLength <= 0xffff, AssemblyException, "Invalid data section size.");
|
||||
toBigEndian(dataLength, eofDataLength);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user