text_finder: Clamp stored match line text to a window around the match#60311
Open
rtfeldman wants to merge 1 commit into
Open
text_finder: Clamp stored match line text to a window around the match#60311rtfeldman wants to merge 1 commit into
rtfeldman wants to merge 1 commit into
Conversation
Each SearchMatch retained a copy of the entire line containing the match, and both construction paths materialized the full buffer text (the imported-matches path once per match). On files with enormous single lines (e.g. minified sources), a broad query could request gigabytes of allocations and abort in the allocator (FR-106). Read the line directly from the buffer snapshot instead, keep at most a small window around the match start, and store the match's true column separately now that relative_range is window-relative.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Investigating FR-106 — a SIGABRT on Linux that aborted inside the allocator while the text finder was copying a matched line — surfaced two plausible causes. The likelier one is the nested-draw arena corruption fixed by #60295, which this PR stacks on (glibc detecting corrupted heap metadata at a later, unrelated allocation matches the crash's stack shape exactly). The other is a real defect in the text finder itself: every
SearchMatchretained a copy of the entire line containing the match, so on a file with one enormous line (e.g. minified sources) every match retained a copy of the whole file, and the imported-matches path also materialized the full buffer text once per match. A broad query against such a file could request tens of gigabytes and die with an allocation failure — the same SIGABRT signature.This fixes the second cause: the stored line text is read directly from the buffer snapshot (no more full-text materialization) and clamped to a small window around the match start, far more than a picker row can display. Since
relative_rangeis now relative to that window rather than the full line, the match's true column is stored separately for cursor placement when opening a result. With both causes addressed, any recurrence of this crash fingerprint on fixed builds indicates a fresh cause and should be reinvestigated.Closes FR-106
Release Notes: