Submitted by 0xSky
https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L342
https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L397
fillCriteriaBid can be reverted due to the pre-check while it can work.
When refererrAmt > 0 and referrer address is not set (is 0),
(o.totalAmt - protocolfee - o.exchange.paymentAmt - o.prePayment.paymentAmt) * amount - p.paymentAmt >= 0 and o.totalAmt < o.exchange.paymentAmt + o.prePayment.paymentAmt + o.refererrAmt can hold true at the same time.
It is when o.refererrAmt > (p.paymentAmt + protocolfee) / amount.
In that case, _settleBalances can work, but fillCriteriaBid will be reverted due to the check in line 342.
I think require(o.totalAmt >= o.exchange.paymentAmt + o.prePayment.paymentAmt) is correct.
0xsaruman (Golom) confirmed, but disagreed with severity and commented:
LSDan (judge) commented:
