microsoft / microsoft/litebox

Cleanup: check for integer overflows on user inputs

Open
#672 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

layer-META
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 where saturating_* is the right move (not just checked_* or wrapping_*). 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.