Cleanup: check for integer overflows on user inputs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.7k
- Forks
- 144
- Avg merge
- 12h 21m
- Merged PRs (30d)
- 146
Description
Thanks for mentioning the arithmetic thing! Indeed we have some number of arith issues that have slipped in over time and we should do a cleanup pass at some point. For now, the semantics seem reasonable enough (i.e., we can just hard set them to checked/wrapping via a compile time flag depending on what we need) but a cleanup would be good. The harder part is longer-term enforcement which I don't have a good solution for (there are some very good reasons to use normal arith, and we can't just ban
+/-/...). Also, briefly: when looking for places to cleanup, we should also look for places wheresaturating_*is the right move (not justchecked_*orwrapping_*). For example, one of the changes I'm working on rn has such a natural use case (let available = data.len().saturating_sub(offset);).
Originally posted by @jaybosamiya-ms in https://github.com/microsoft/litebox/issues/668#issuecomment-3923925897
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by locating arithmetic on user inputs across the Rust codebase, then review each site for checked, wrapping, or saturating behavior. Done means the cleanup scope is addressed and the selected arithmetic semantics are covered by the existing relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems, security
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100