xiph / xiph/opus

v1.3.1 -- Memory scribble when changing ENCODER_NUM_CHANNELS from 2 -> 1

Open
#204 3 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

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

  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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.