Potential arithmetic overflow in Generator#nextAuctionLengthMs()
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 205
Description
```
long numEventsForAuctions =
(config.configuration.numInFlightAuctions * GeneratorConfig.PROPORTION_DENOMINATOR)
/ GeneratorConfig.AUCTION_PROPORTION;
```
The multiplication is done on 32-bit integers while long is expected (numEventsForAuctions).
There is possibility for arithmetic overflow
Imported from Jira [BEAM-2805](https://issues.apache.org/jira/browse/BEAM-2805). Original Jira may contain additional context.
Reported by: yuzhihong@gmail.com.
Contributor guide
Research direction
Start by locating Generator#nextAuctionLengthMs() and inspect the arithmetic involving numInFlightAuctions, PROPORTION_DENOMINATOR, and AUCTION_PROPORTION. Confirm the multiplication is evaluated without 32-bit overflow, then check relevant existing tests or add coverage demonstrating correct behavior for large values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100