diff --git a/libethereum/Instruction.cpp b/libethereum/Instruction.cpp index 2d3f4e64b..762045db2 100644 --- a/libethereum/Instruction.cpp +++ b/libethereum/Instruction.cpp @@ -585,10 +585,24 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s) else if (ii >= 2 && !i.tag() && i.which() == sp::utree_type::any_type) { bigint bi = *i.get(); - if (bi < 0 || bi > bigint(u256(0) - 1)) + if (bi < 0) error(); - data.resize(data.size() + 32); - *(h256*)(&data.back() - 31) = (u256)bi; + else if (bi > bigint(u256(0) - 1)) + { + if (ii == 2 && _t.size() == 3) + { + // One big int - allow it as hex. + data.resize(bytesRequired(bi)); + toBigEndian(bi, data); + } + else + error(); + } + else + { + data.resize(data.size() + 32); + *(h256*)(&data.back() - 31) = (u256)bi; + } } else if (ii) error();