mirror of https://github.com/status-im/nim-eth.git
eip2718: protect against malformed rlp in tx sequence decoder
This commit is contained in:
parent
ef49a6f50a
commit
d0eb2de328
|
@ -379,6 +379,9 @@ proc read*(rlp: var Rlp, T: type Transaction): T =
|
||||||
proc read*(rlp: var Rlp, t: var EthBlock, _: type seq[Transaction]): seq[Transaction] {.inline.} =
|
proc read*(rlp: var Rlp, t: var EthBlock, _: type seq[Transaction]): seq[Transaction] {.inline.} =
|
||||||
# EIP 2718/2930: we have to override this field
|
# EIP 2718/2930: we have to override this field
|
||||||
# for reasons described below in `append` proc
|
# for reasons described below in `append` proc
|
||||||
|
if not rlp.isList:
|
||||||
|
raise newException(MalformedRlpError,
|
||||||
|
"List expected, but got blob.")
|
||||||
for tx in rlp:
|
for tx in rlp:
|
||||||
if tx.isList:
|
if tx.isList:
|
||||||
result.add tx.read(Transaction)
|
result.add tx.read(Transaction)
|
||||||
|
|
Loading…
Reference in New Issue