From beb97784d43ece5acde365a74efe8763692ebdba Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Sat, 18 Mar 2023 18:15:59 +0100 Subject: [PATCH] Error handling to beacon chain gossip (#7132) --- cl/cltypes/ssz_utils/ssz.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cl/cltypes/ssz_utils/ssz.go b/cl/cltypes/ssz_utils/ssz.go index 80b9999a1d8..91a48b3ac0d 100644 --- a/cl/cltypes/ssz_utils/ssz.go +++ b/cl/cltypes/ssz_utils/ssz.go @@ -99,7 +99,9 @@ func DecodeDynamicList[T Unmarshaler](bytes []byte, start, end, max uint32) ([]T return nil, ErrBadOffset } objs[i] = objs[i].Clone().(T) - objs[i].DecodeSSZ(buf[currentOffset:endOffset]) + if err := objs[i].DecodeSSZ(buf[currentOffset:endOffset]); err != nil { + return nil, err + } currentOffset = endOffset } return objs, nil @@ -121,7 +123,9 @@ func DecodeStaticList[T Unmarshaler](bytes []byte, start, end, bytesPerElement u objs := make([]T, elementsNum) for i := range objs { objs[i] = objs[i].Clone().(T) - objs[i].DecodeSSZ(buf[i*int(bytesPerElement):]) + if err := objs[i].DecodeSSZ(buf[i*int(bytesPerElement):]); err != nil { + return nil, err + } } return objs, nil }