Either in loadNode() or Node#UnmarshalCBOR() we should be checking that:
One of the Values or Links arrays is not set / nil (zero elements in CBOR)
The one that is set contains exactly bits.OnesCount8(n.Bmap[0]) elements
Any other variants should be rejected as malformed.
If this isn't done in Node#UnmarshalCBOR(), the check will need to also be applied in LoadAMT to the root node, which is deserialized along with its containing parent (Root).
Either in
loadNode()
orNode#UnmarshalCBOR()
we should be checking that:Values
orLinks
arrays is not set /nil
(zero elements in CBOR)bits.OnesCount8(n.Bmap[0])
elementsAny other variants should be rejected as malformed.
If this isn't done in
Node#UnmarshalCBOR()
, the check will need to also be applied inLoadAMT
to the root node, which is deserialized along with its containing parent (Root
).