Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Investigate clientChannels[] out of bounds read/crash

未关闭
#3,926 4 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 6 天内回复

@ann0see 已经在做这个了。

开始于 2026年8月27日。

  • #3970 来自 @JohnZ622 —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

AI bug good first issue

Describe the bug

INVALID_INDEX might not be checked everywhere correctly. AI found out that there could be an out of bounds read possiblity in client.cpp if calling SetRemoteChanGain:

https://github.com/jamulussoftware/jamulus/blob/508f1f3d3ea41b0da76da128ee5d3f3f1b2fafc7/src/client.cpp#L1020-L1031

To Reproduce

Not tested. Would probably need some server side trigger with invalid Channel ID.
Probably worth checking on the protocol level for invalid IDs.

Ox Alpha (GLM 5.3-Flash) suggested:

Guard the call site (minimal change):

if ( iChanID != INVALID_INDEX && bMuteMeInPersonalMix ) { ... }

and/or reject invalid IDs in EvaluateClientIDMes; optionally add a defensive Q_ASSERT/range check in SetRemoteChanGain/SetRemoteChanPan mirroring OnControllerInFaderLevel (client.cpp:956). Related latent gap: OnControllerInPanValue (client.cpp:965-975) lacks the bounds check its fader sibling has.

Expected behavior

No crash

AI analysis

  • src/protocol.cpp:1046-1063 (EvaluateClientIDMes) — validates only body size (1 byte); the ID value itself (0–255) is passed through unchecked.
  • src/client.cpp:1010-1036 (CClient::OnClientIDReceived):
int iChanID = FindClientChannel ( iServerChanID, true ); // should always return channel 0
...
if ( bMuteMeInPersonalMix )
{
    SetRemoteChanGain ( iChanID, 0, false );   // iChanID can be INVALID_INDEX (-1)
}
  • src/client.cpp:1833-1885 (FindClientChannel) returns INVALID_INDEX (-1) when iServerChannelID < 0 || >= MAX_NUM_CHANNELS or when all 150 client channel slots are occupied.
  • src/client.cpp:506-539 (SetRemoteChanGain): &clientChannels[iId] with no bounds check →
    • timer inactive: OOB write at client.cpp:535 (clientChan->oldGain = clientChan->newGain = fGain;) plus OOB read of iServerChannelID fed to Channel.SetRemoteChanGain() (that callee is range-checked, channel.cpp:302);
    • timer active: OOB write at client.cpp:522, and minGainOrPanId = -1 causes OnTimerRemoteChanGainOrPan (client.cpp:546-548) to iterate from index −1 afterwards.
  • clientChannels is a fixed CClientChannel[150] member array (src/client.h:392).

Contrast with the correct pattern used 700 lines earlier: OnMuteStateHasChangedReceived checks if ( iChanID != INVALID_INDEX ) (client.cpp:340-346).

主要语言
C
星标
1.1k
派生
248
平均合并
11 天 40 分钟
30 天内合并 PR
6

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jamulussoftware/jamulus 的其他 Issue

查看 jamulussoftware/jamulus 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。