SWC-101 Arithmetic Overflow on parameter params.depositInterval. BondFixedExpiryOSDAV1.t.sol BondFixedExpiryOSDA.sol function testCorrectness_CannotCreateMarketWithInvalidParams() params.depositInterval.
SWC-101 Arithmetic Overflow on parameter params.depositInterval. BondFixedExpiryOSDAV1.t.sol BondFixedExpiryOSDA.sol function testCorrectness_CannotCreateMarketWithInvalidParams() params.depositInterval.
Summary
The Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration should revert if not the case when. called. But it does not revert when using integer overflow on the deposit interval parameter. 1 call to test the Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration using overflow does not revert. The result is market created with several payout tokens.
Vulnerability Detail
// In the function
// function testCorrectness_CannotCreateMarketWithInvalidParams()
// the following line was suffixed with integer overflow.
// Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration
params.depositInterval = uint48(1 hours - 1) + uint48(1); // fat32 ovf
vm.expectRevert(err);
auctioneer.createMarket(abi.encode(params));
Impact
The Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration should revert if not the case when. called. But it does not revert when using integer overflow on the deposit interval parameter. 1 call to test the Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration using overflow does not revert. The result is market created with several payout tokens.
// Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration
params.depositInterval = uint48(1 hours - 1) + uint48(1); // fat32 ovf
vm.expectRevert(err);
auctioneer.createMarket(abi.encode(params));
forge test -vvv --match-path src/test/OSDA/BondFixedExpiryOSDAV1.t.sol
fat32
high
SWC-101 Arithmetic Overflow on parameter params.depositInterval. BondFixedExpiryOSDAV1.t.sol BondFixedExpiryOSDA.sol function testCorrectness_CannotCreateMarketWithInvalidParams() params.depositInterval.
SWC-101 Arithmetic Overflow on parameter params.depositInterval. BondFixedExpiryOSDAV1.t.sol BondFixedExpiryOSDA.sol function testCorrectness_CannotCreateMarketWithInvalidParams() params.depositInterval.
Summary
The Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration should revert if not the case when. called. But it does not revert when using integer overflow on the deposit interval parameter. 1 call to test the Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration using overflow does not revert. The result is market created with several payout tokens.
Vulnerability Detail
Impact
The Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration should revert if not the case when. called. But it does not revert when using integer overflow on the deposit interval parameter. 1 call to test the Deposit interval must be greater than the minimum deposit interval and less than or equal to the market duration using overflow does not revert. The result is market created with several payout tokens.
Code Snippet
Vulnerable code
POC> src/2023-02-bond-0xtr3/bonds/src/test/OSDA/BondFixedExpiryOSDAV1.t.sol
Tool used
Foundry and Visual Studio Code.
Manual Review Log File:
Recommendation
Use safe math.