mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 06:46:10 +00:00
Fix a potential OOB error in SSZ deserialization
This commit is contained in:
parent
c39d4f1817
commit
a336285922
@ -80,7 +80,8 @@ proc readSszValue*(input: openarray[byte], T: type): T =
|
|||||||
type ElemType = type result[0]
|
type ElemType = type result[0]
|
||||||
when ElemType is byte|char:
|
when ElemType is byte|char:
|
||||||
result.setLen input.len
|
result.setLen input.len
|
||||||
copyMem(addr result[0], unsafeAddr input[0], input.len)
|
if input.len > 0:
|
||||||
|
copyMem(addr result[0], unsafeAddr input[0], input.len)
|
||||||
|
|
||||||
elif isFixedSize(ElemType):
|
elif isFixedSize(ElemType):
|
||||||
const elemSize = fixedPortionSize(ElemType)
|
const elemSize = fixedPortionSize(ElemType)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user