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

Ouverte Adaptée aux débutants
#13,417 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
84/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
macos, swift
Domaine
api, desktop

Piste de recherche

Commencez par WorkspaceReorderCoordinator.reorderWorkspace(tabId:toIndex:isDragOperation:explicitGroupId:) et suivez comment ControlCommandCoordinator.handle(_:) lui transmet l’index du control-socket. Testez workspace.reorder avec un toIndex hors limites et vérifiez que l’application reste en cours d’exécution tandis que la requête est rejetée en toute sécurité ou traitée comme un no-op.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Swift
Étoiles
27.3k
Forks
2.4k
Merge moyen
12 h 48 min
PR mergées (30 j)
533

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de manaflow-ai/cmux

Toutes les issues de manaflow-ai/cmux

Issues similaires

Plus d'issues Swift

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.