SWC-101 Arithmetic Underflow on parameter params.fixedDiscount. BondFixedExpiryOFDAV1.t.sol function testCorrectness_CannotCreateMarketWithInvalidParams() params.fixedDiscount
SWC-101 Arithmetic Underflow on parameter params.fixedDiscount. BondFixedExpiryOFDAV1.t.sol function testCorrectness_CannotCreateMarketWithInvalidParams() params.fixedDiscount
Summary
The Fixed discount must be between 0 and 100e3 (100%) (but not 100e3). But it does not revert when using integer underflow. 1 call to test the Fixed discount must be between 0 and 100e3 (100%) (but not 100e3) using underflow does not revert even though the underflow sets the value to 100e3.
The Fixed discount must be between 0 and 100e3 (100%) (but not 100e3). But it does not revert when using integer underflow. 1 call to test the Fixed discount must be between 0 and 100e3 (100%) (but not 100e3) using underflow does not revert even though the underflow sets the value to 100e3.
Code Snippet
POC> src/test/OFDA/BondFixedExpiryOFDAV1.t.sol
// Fixed discount must be between 0 and 100e3 (100%) (but not 100e3)
params.fixedDiscount = uint48(100e3) - uint48(1); // fat32 udf
vm.expectRevert(err);
auctioneer.createMarket(abi.encode(params));
forge test -vvv --match-path src/test/OFDA/BondFixedExpiryOFDAV1.t.sol
fat32
medium
SWC-101 Arithmetic Underflow on parameter params.fixedDiscount. BondFixedExpiryOFDAV1.t.sol function testCorrectness_CannotCreateMarketWithInvalidParams() params.fixedDiscount
SWC-101 Arithmetic Underflow on parameter params.fixedDiscount. BondFixedExpiryOFDAV1.t.sol function testCorrectness_CannotCreateMarketWithInvalidParams() params.fixedDiscount
Summary
The Fixed discount must be between 0 and 100e3 (100%) (but not 100e3). But it does not revert when using integer underflow. 1 call to test the Fixed discount must be between 0 and 100e3 (100%) (but not 100e3) using underflow does not revert even though the underflow sets the value to 100e3.
Vulnerability Detail
Impact
The Fixed discount must be between 0 and 100e3 (100%) (but not 100e3). But it does not revert when using integer underflow. 1 call to test the Fixed discount must be between 0 and 100e3 (100%) (but not 100e3) using underflow does not revert even though the underflow sets the value to 100e3.
Code Snippet
POC> src/test/OFDA/BondFixedExpiryOFDAV1.t.sol
Tool used
Foundry and Visual Studio Code.
Manual Review Log File:
Recommendation
Use safe math.