0.64.25 workspace.reorder with out-of-range index crashes app (unchecked Array.insert)

未关闭 适合新手
#13,417 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
84/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
macos, swift
领域
api, desktop

调研方向

从 WorkspaceReorderCoordinator.reorderWorkspace(tabId:toIndex:isDragOperation:explicitGroupId:) 开始,跟踪 ControlCommandCoordinator.handle(_:) 如何将 control-socket index 传递给它。使用超出范围的 toIndex 执行 workspace.reorder,并验证应用仍在运行,同时请求会被安全地拒绝或作为 no-op 处理。

由索引模型根据 Issue 内容生成。

描述

Confirmed customer report

An out-of-range toIndex sent to workspace.reorder over the control socket kills the app with EXC_BREAKPOINT / SIGTRAP on the main thread: Array._checkIndex -> Array.insert(_:at:) in WorkspaceReorderCoordinator.reorderWorkspace(tabId:toIndex:isDragOperation:explicitGroupId:) via ControlCommandCoordinator.handle(_:). No clamping or validation happens before the insert, so any client that computes a bad index (custom sidebar, CLI, extension) gets a guaranteed crash instead of an error.

The reporter was drag-reordering in a custom sidebar (fork of Examples/CustomSidebars/workspaces.js) with 5 workspaces in one window; the drop dispatched workspace.reorder with an index out of range for the internal array, and the whole app died, losing two workspaces from the window.

The reporter notes this is easy to hit from the documented data contract: a sidebar author only has workspaces[i].index to work from, and that value can disagree with the array reorderWorkspace indexes into. The shipped workspaces.js example computes its index the same way.

Evidence

Crash report: cmux-2026-09-21-143234.ips, incident 55593AFE-A396-4FB3-ACEE-2D69684271B4.

Workaround (reporter side): clamp the index to [0, count-1] before calling cmux("workspace.reorder").

  • Reporter: florian.freudenberg@zenjob.com

Source report: Gmail 1a0c3fddfbb3944b

Environment:

  • cmux 0.64.25 (build 106, commit b685a275c)
  • macOS 26.6.2 (Build 25G83)
  • Mac15,6, Apple M3 Pro, 36 GB

Expected

A control command arriving over the socket should never be able to terminate the app. reorderWorkspace should clamp or early-return on an out-of-range toIndex, making a bad index a no-op error rather than a crash.

主要语言
Swift
星标
27.3k
派生
2.4k
平均合并
12 小时 48 分钟
30 天内合并 PR
533

贡献指南

打开贡献指南

从这里开始

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

manaflow-ai/cmux 的其他 Issue

查看 manaflow-ai/cmux 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 发到你的邮箱

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