Limiting the stack allocation request
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.3k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
We're testing with Opus APIs and want to suggest a potential fix in opus_decode for limiting a stack allocation request ALLOC.
Its argument frame_size is passed into ALLOC (https://github.com/xiph/opus/blob/v1.5.1/src/opus_decoder.c#L884) and maybe there could be a check before the stack allocation (if it doesn't enter line https://github.com/xiph/opus/blob/v1.5.1/src/opus_decoder.c#L875) so that it wouldn't accept any bad value and having undefined behaviors?
Contributor guide
No contributing guide indexed for this repository
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 in src/opus_decoder.c at opus_decode, especially the checks around lines 875 and 884, and trace how frame_size reaches ALLOC. Determine which invalid values can bypass the existing check and reach the stack allocation. Done means the invalid request is rejected safely and the relevant decoder behavior is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100