Language: Go
Label: safe
CWE: CWE-400 \u2014 Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.

Code:
func TestBasicSet(t *testing.T) {
	ds, lsys := mockDag()
	for _, w := range []int{128, 256, 512, 1024} {
		t.Run(fmt.Sprintf("BasicSet%d", w), func(t *testing.T) {
			names, s, err := makeDirWidth(ds, 1000, w)
			require.NoError(t, err)
			ctx := context.Background()
			legacyNode, err := s.Node()
			require.NoError(t, err)
			nd, err := lsys.Load(ipld.LinkContext{Ctx: ctx}, cidlink.Link{Cid: legacyNode.Cid()}, dagpb.Type.PBNode)
			require.NoError(t, err)
			hamtShard, err := hamt.AttemptHAMTShardFromNode(ctx, nd, lsys)
			require.NoError(t, err)
			for _, d := range names {
				_, err := hamtShard.LookupByString(d)
				require.NoError(t, err)
			}
		})
	}
}