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

Offen Anfängerfreundlich
#13,417 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
84/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
macos, swift
Bereich
api, desktop

Rechercherichtung

Beginne bei WorkspaceReorderCoordinator.reorderWorkspace(tabId:toIndex:isDragOperation:explicitGroupId:) und verfolge, wie ControlCommandCoordinator.handle(_:) den control-socket index dorthin weitergibt. Führe workspace.reorder mit einem toIndex außerhalb des gültigen Bereichs aus und überprüfe, dass die App weiterläuft, während die Anfrage sicher abgewiesen oder als No-op behandelt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Swift
Sterne
27.3k
Forks
2.4k
Ø Merge
12 Std. 48 Min.
Gemergte PRs (30 T.)
533

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus manaflow-ai/cmux

Alle Issues in manaflow-ai/cmux

Ähnliche Issues

Weitere Issues zu Swift

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.