<!-- canonical: https://0xsimao.com/findings/mitosis-redeem-queue-reverts-underflow -->

# RedeemQueue::get() reverts due to underflow when it should revert and throw the correct error

Low/Info · Three Sigma · Cross-chain liquidity layer 1 · 25th June, 2024

Finding 3S-Mitosis-N10 of the Mitosis security review.

- Protocol: https://mitosis.org/
- Report: /reports/mitosis
- Source: https://cdn.sanity.io/files/qoqld077/production/b6b3bd7bb47407d99e76abb7c6dc615c1db5018e.pdf

---

### Description

RedeemQueue::get() reverts due to underflow if index_.count == 0 instead of the error
IndexOutOfRange.

### Recommendation

IndexOutOfRange(index._offset, index._count, idx);

### Status

Addressed in [#17568a7](https://github.com/mitosis-org/evm/pull/205/commits/17568a7d13430e2fa92757f36bff707da81c1659#diff-8b520e9d94716f78386c8442e6a6479cb007e0b7553db974300c6ecd20ac985e).

---

Related findings:

- [Queue MapleWithdrawalManager may revert due to honest removeShares() or manual redeem calls](https://0xsimao.com/findings/maple-finance-ii-queue-withdrawal-shares-redeem): Maple Withdrawal Manager
- [API3 oracle timestamp can be set to future timestamp and block API3 Oracle usage to make code revert in underflow](https://0xsimao.com/findings/init-capital-ii-oracle-timestamp-revert-underflow): INIT Capital
- [EIP712's _revertIfError should use all SignatureChecker.Error errors](https://0xsimao.com/findings/m-0-eip712-revert-signature-checker): M^0 Minter Gateway
- [ERC4626::previewRedeem() may revert, which will DoS MaplePool withdrawals](https://0xsimao.com/findings/maple-finance-iv-erc4626-redeem-revert-withdrawals): Maple Cash Strategies
