You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Editor: remaining unguarded text-storage ranges on the layout and highlight paths #2340
Found while fixing #2338. Each of these reads or writes a text-storage range that can transiently outrun the storage, and each raises rather than clamping. On macOS 26 and later an exception raised inside a draw or layout pass terminates the app.
Ranked by reachability:
LocalPackages/CodeEditTextView/Sources/CodeEditTextView/TextLine/TextLine.swift:57, stringRef.attributedSubstring(from: range) in prepareForDisplay, reached from the layout pass at TextLayoutManager+Layout.swift:241. range is position.range from lineStorage, which is known to transiently outrun the string during an edit. This is the layout-pass twin of the rectForOffset crash fixed in fix(editor): stop the rectForOffset crash and keep the autocomplete popup below the caret #1835. Every other consumer of that invariant got a guard in that commit; this one did not.
LocalPackages/CodeEditSourceEditor/Sources/CodeEditSourceEditor/Highlighting/Highlighter.swift:279, storage?.setAttributes(_, range: range) raises NSRangeException if the style container's runs outrun the storage. Lower confidence: styleContainer.updateStorageLength tracks edits, so the stale window could not be constructed by reading alone.
LocalPackages/CodeEditTextView/Sources/CodeEditTextView/TextView/TextView+Accessibility.swift:141, the guard is index < documentRange.length with no lower bound, so a negative index from an accessibility client reaches rangeOfComposedCharacterSequence(at:) and raises "The index -1 is invalid". One-line fix.
LocalPackages/CodeEditSourceEditor/Sources/CodeEditSourceEditor/Minimap/MinimapLineFragmentView.swift:82-95, textStorage.attribute(.foregroundColor, at:longestEffectiveRange:in:) and character(at:) with positions from newFragment.documentRange and no bounds check. Currently unreachable: EditorPeripherals.swift:62 is the only construction site and hardcodes showMinimap: false. It is a landmine for whoever turns the minimap on, since the minimap's standalone layout manager is exactly the one that goes stale.
Checked and clean, so nobody re-hunts them: all of TablePro's own drawing code, every NSColor component read (all guarded by usingColorSpace), and the NaN sinks in NSRectFill, NSString.draw(in:), NSCell.draw(withFrame:) and CGContext.fill, none of which raise.
Activity