xiph / xiph/opus

Limiting the stack allocation request

Open
#329 2 comments 0 reactions 0 assignees View on GitHub

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

  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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.