v1.3.1 -- Memory scribble when changing ENCODER_NUM_CHANNELS from 2 -> 1
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.3k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Description
I am using opus, tag v1.3.1, with ENCODER_NUM_CHANNELS set to 1 (default=2) to reduce the encoder memory requirements.
With this configuration, line 166 in enc_API.c causes a memory scribble as the encoder ctx does not have the second channel allocated:
psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded = psEnc->state_Fxx[ 1 ].sCmn.nFramesEncoded = 0;
This was overwriting a pointer in an unrelated part of my application, resulting in undefined behavior. I believe this is a critical bug. I have addressed it in my application so this is not critical for me, but just wanted to notify you guys.
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 enc_API.c at line 166 and inspect how encoder state is allocated when ENCODER_NUM_CHANNELS is set to 1. Reproduce the configuration with one channel and verify that initialization no longer writes beyond the allocated encoder context without affecting the default two-channel case.
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
- Clearly specified
- Newbie friendliness
- 35/100