Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

spyrosonic10 - Possible subtraction overflow in mintRollovers #359

Closed
sherlock-admin opened this issue Mar 27, 2023 · 0 comments
Closed
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Mar 27, 2023

spyrosonic10

medium

Possible subtraction overflow in mintRollovers

Summary

mintRollovers() keeps accounting of indexes it has processed from rolloverQueue in rolloverAccounting[_epochId]. And later when this function is called logic doesn't check the relationship between index and length and this is important as length of rolloverQueue can decrease due to a call from delistInRollover.

Vulnerability Detail

Due to delist feature length can be shortened and this will lead to index being higher than rolloverQueue.length and can cause underflow error. Due to an underflow error mintRollovers() will not work.

    	uint256 length = rolloverQueue.length;
    	uint256 index = rolloverAccounting[_epochId];

    	// revert if queue is empty or operations are more than queue length
    	if (length == 0) revert OverflowQueue();

    	if (_operations > length || (index + _operations) > length)
        	_operations = length - index;

Impact

mintRollovers() will not work as intended.

Code Snippet

Carousel.sol#L371-L378

Tool used

Manual Review

Recommendation

Consider handling rolloverAccounting and delist properly

Duplicate of #72

@github-actions github-actions bot closed this as completed Apr 3, 2023
@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Apr 3, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant