mirror of https://github.com/status-im/nim-eth.git
Add remaining bytes check in toBytes
This commit is contained in:
parent
d2d6d7fc16
commit
f40bf032ba
|
@ -227,7 +227,14 @@ proc toBytes*(self: Rlp): BytesRange =
|
||||||
raise newException(RlpTypeMismatch,
|
raise newException(RlpTypeMismatch,
|
||||||
"Bytes expected, but the source RLP in not a blob")
|
"Bytes expected, but the source RLP in not a blob")
|
||||||
|
|
||||||
let payloadLen = payloadBytesCount()
|
let
|
||||||
|
payloadLen = payloadBytesCount()
|
||||||
|
payloadOffset = payloadOffset()
|
||||||
|
remainingBytes = bytes.len - position - payloadOffset
|
||||||
|
|
||||||
|
if payloadLen > remainingBytes:
|
||||||
|
eosError()
|
||||||
|
|
||||||
if payloadLen > 0:
|
if payloadLen > 0:
|
||||||
let
|
let
|
||||||
payloadOffset = payloadOffset()
|
payloadOffset = payloadOffset()
|
||||||
|
|
Loading…
Reference in New Issue