Skip to content
Snippets Groups Projects
Commit 652db390 authored by George Nachman's avatar George Nachman
Browse files

Don't search more than 500,000 cells in a very long line to avoid hangs. This...

Don't search more than 500,000 cells in a very long line to avoid hangs. This is tricky to split up into multiple searches since lines can change.
parent dc2295eb
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1312,12 +1312,16 @@ static int Search(NSString* needle,
skipped = 0;
}
NSMutableArray* newResults = [NSMutableArray arrayWithCapacity:1];
// Don't search arbitrarily long lines. If someone has a 10 million character long line then
// it'll hang for a long time.
static const int MAX_SEARCHABLE_LINE_LENGTH = 500000;
[self _findInRawLine:entry
needle:substring
options:options
mode:mode
skip:skipped
length:[self _lineLength: entry]
length:MIN(MAX_SEARCHABLE_LINE_LENGTH, [self _lineLength: entry])
multipleResults:multipleResults
results:newResults];
for (ResultRange* r in newResults) {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment