Missing Bounds Check in updateWithdrawQueue Leading to Untraceable Revert Errors
Summary
The updateWithdrawQueue function does not validate if indexes[i] exceeds the length of the withdrawQueue before accessing it. This can cause a native "Index out of bounds" error, making it difficult to trace where the revert is happening, which could complicate debugging and troubleshooting.
Impact
The lack of an explicit bounds check may result in a native revert, making it hard to determine the exact source of the issue during execution. This could lead to operational inefficiencies and delays in resolving the error.
from the comment it was clearly seen that this revert was supposed to be included in the error library, but it was never done.
Add an explicit check to ensure that prevIndex is within bounds, improving error traceability:
Copy code
if (prevIndex >= currLength) revert CuratedErrorsLib.IndexOutOfBounds();
Happy Corduroy Dalmatian
Low/Info
Missing Bounds Check in updateWithdrawQueue Leading to Untraceable Revert Errors
Summary
The
updateWithdrawQueue
function does not validate if indexes[i] exceeds the length of the withdrawQueue before accessing it. This can cause a native "Index out of bounds" error, making it difficult to trace where the revert is happening, which could complicate debugging and troubleshooting.Impact
The lack of an explicit bounds check may result in a native revert, making it hard to determine the exact source of the issue during execution. This could lead to operational inefficiencies and delays in resolving the error.
Code Snippet
https://github.com/sherlock-audit/2024-06-new-scope/blob/c8300e73f4d751796daad3dadbae4d11072b3d79/zerolend-one/contracts/core/vaults/CuratedVault.sol#L202
Tool used
Manual Review
Recommendation
from the comment it was clearly seen that this revert was supposed to be included in the error library, but it was never done. Add an explicit check to ensure that prevIndex is within bounds, improving error traceability: Copy code