Language: Go
Label: safe
CWE: CWE-1284 \u2014 Improper Validation of Specified Quantity in Input
The product receives input that is expected to specify a quantity (such as size or length), but it does not validate or incorrectly validates that the quantity has the required properties.

Code:
func BenchmarkBytes(b *testing.B) {
	bfa, err := NewBitfield(216)
	assertNoError(b, err)
	bfb, err := NewBitfield(216)
	assertNoError(b, err)
	for j := 0; j*4 < 216; j++ {
		bfa.SetBit(j * 4)
	}
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		bfb.SetBytes(bfa.Bytes())
	}
}