riscv-software-src / riscv-software-src/opensbi
integer overflows in __sbi_fifo_enqueue() and sbi_fifo_dequeue()?
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 712
- PR merge metrics
- No merged PRs in 30d
Description
Hello, is there a chance for these additions and multiplications to overflow? I didn't see any constraints imposed elsewhere that would prevent this from overflowing given large enough values of queue, head, and entry_size.
There's similar code in sbi_fifo_dequeue().
Thanks
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
Start with lib/sbi/sbi_fifo.c at the linked line and inspect __sbi_fifo_enqueue() alongside the similar arithmetic in sbi_fifo_dequeue(). Trace how queue, head, and entry_size are constrained elsewhere, then determine whether large values can overflow. Done means the overflow risk is resolved or formally ruled out, with validation for the relevant cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100