Add remaining bytes check in toBytes

This commit is contained in:
kdeme 2019-05-31 14:23:30 +02:00 committed by zah
parent d2d6d7fc16
commit f40bf032ba
1 changed files with 8 additions and 1 deletions

View File

@ -227,7 +227,14 @@ proc toBytes*(self: Rlp): BytesRange =
raise newException(RlpTypeMismatch,
"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:
let
payloadOffset = payloadOffset()