Language: Go
Label: safe
CWE: CWE-20 \u2014 Improper Input Validation
The product receives input or data, but it does
        not validate or incorrectly validates that the input has the
        properties that are required to process the data safely and
        correctly.

Code:
func (e *ERC20LogicView) FindBridgeStopped(
	al *types.ERC20EventBridgeStopped,
	blockNumber,
	logIndex uint64,
	txHash string,
) error {
	bf, err := bridgecontract.NewErc20BridgeLogicRestrictedFilterer(
		e.clt.CollateralBridgeAddress(), e.clt)
	if err != nil {
		return err
	}

	resp := "ok"
	defer func() {
		metrics.EthCallInc("find_bridge_stopped", resp)
	}()

	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()
	iter, err := bf.FilterBridgeStopped(
		&bind.FilterOpts{
			Start:   blockNumber - 1,
			Context: ctx,
		},
	)
	if err != nil {
		resp = getMaybeHTTPStatus(err)
		return err
	}
	defer iter.Close()

	var event *bridgecontract.Erc20BridgeLogicRestrictedBridgeStopped

	for iter.Next() {
		if iter.Event.Raw.BlockNumber == blockNumber &&
			uint64(iter.Event.Raw.Index) == logIndex &&
			iter.Event.Raw.TxHash.Hex() == txHash {
			event = iter.Event

			break
		}
	}

	if event == nil {
		return ErrUnableToFindERC20BridgeStopped
	}

	// now ensure we have enough confirmations
	if err := e.ethConfs.Check(event.Raw.BlockNumber); err != nil {
		return err
	}

	return nil
}