# DOS while dealing with erc20 when value(i.e amount*decimals) is high but less than type(uint112).max

Locke.sol overflow on amount*decimals for large-but-valid stakes causes exit/withdraw to revert, permanently locking user funds.

- Payout: Audit contest
- Severity: high
- Program: Streaming Protocol
- Found by: hack3r-0m
- Disclosed: 2022-02-11
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2021-11-streaming-findings/issues/228
- Library page: https://bugbountylibrary.com/r/c4%3A2021-11-streaming%3AH-09
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:dos

**Target:** Locke.sol streaming/staking contract (ERC20 accounting)
**Root cause:** Arithmetic at Locke.sol#L229 multiplies amount by decimals in a narrower type, overflowing for values below type(uint112).max and reverting exit/withdraw.
**Steps:**
1. Fund stream and stake with large amounts (e.g. 10**13 * 10**18) so amount*decimals overflows the intermediate type
2. Warp to end of stream
3. Call exit/withdraw or claimReward; transaction reverts due to overflow
4. Funds remain permanently locked for that user
**How found:** Manual review of arithmetic in Locke.sol#L229; noticed multiplication of amount by decimals could overflow for high values still under type(uint112).max, then reproduced via modified test with large stake amounts.
**Exploitation:** Any staker depositing a large-but-valid amount triggers the overflow; subsequent exit/withdraw reverts, permanently trapping their stake. No attacker capital needed beyond the deposit itself.
**Insight:** Check multiplication of user-controlled amounts by token decimals against the storage/return type width; values just under a type max can still overflow intermediate math and brick withdrawals.
