mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add upper bound assert for PushSub/PushSubSize
This commit is contained in:
parent
dce52509b4
commit
59df7dbc1b
@ -596,12 +596,14 @@ LinkerObject const& Assembly::assemble() const
|
||||
ret.bytecode.resize(ret.bytecode.size() + bytesPerDataRef);
|
||||
break;
|
||||
case PushSub:
|
||||
assertThrow(i.data() <= size_t(-1), AssemblyException, "");
|
||||
ret.bytecode.push_back(dataRefPush);
|
||||
subRef.insert(make_pair(size_t(i.data()), ret.bytecode.size()));
|
||||
ret.bytecode.resize(ret.bytecode.size() + bytesPerDataRef);
|
||||
break;
|
||||
case PushSubSize:
|
||||
{
|
||||
assertThrow(i.data() <= size_t(-1), AssemblyException, "");
|
||||
auto s = m_subs.at(size_t(i.data()))->assemble().bytecode.size();
|
||||
i.setPushedValue(u256(s));
|
||||
uint8_t b = max<unsigned>(1, dev::bytesRequired(s));
|
||||
|
Loading…
Reference in New Issue
Block a user