Fix possible AssertionError in typedranges on rlp reading invalid list

This commit is contained in:
kdeme 2019-10-09 22:05:47 +02:00
parent 4b154e56c7
commit 4cf3262902
No known key found for this signature in database
GPG Key ID: 4E8DD21420AF43F5
1 changed files with 3 additions and 0 deletions

View File

@ -364,6 +364,9 @@ proc readImpl(rlp: var Rlp, T: type[object|tuple],
mixin enumerateRlpFields, read mixin enumerateRlpFields, read
if wrappedInList: if wrappedInList:
if not rlp.isList:
raise newException(RlpTypeMismatch,
"List expected, but the source RLP is not a list.")
var var
payloadOffset = rlp.payloadOffset() payloadOffset = rlp.payloadOffset()
payloadEnd = rlp.position + payloadOffset + rlp.payloadBytesCount() payloadEnd = rlp.position + payloadOffset + rlp.payloadBytesCount()