Language: Go
Label: vulnerable
CWE: CWE-697 \u2014 Incorrect Comparison
The product compares two entities in a security-relevant context, but the comparison is incorrect, which may lead to resultant weaknesses.

Code:
func (circuit *recursiveHint) Define(api frontend.API) error {
	// first hint produces wire w1
	w1, _ := api.Compiler().NewHint(make3, 1)

	// this linear expression is not recorded in a R1CS just yet
	linearExpression := api.Add(circuit.A, w1[0])

	// api.ToBinary calls another hint (bits.NBits) with linearExpression as input
	// however, when the solver will resolve bits[...] it will need to detect w1 as a dependency
	// in order to compute the correct linearExpression value
	bits := api.ToBinary(linearExpression, 10)

	a := api.FromBinary(bits...)

	api.AssertIsEqual(a, 45)

	return nil
}