mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
don't get stuck in _wordenize, don't allow evil regexp as word definition, fixes #3963
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
import {Emitter} from 'vs/base/common/event';
|
||||
import {score} from 'vs/editor/common/modes/languageSelector';
|
||||
import {regExpLeadsToEndlessLoop} from 'vs/base/common/strings';
|
||||
import {Remotable, IThreadService} from 'vs/platform/thread/common/thread';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import {ExtHostFileSystemEventService} from 'vs/workbench/api/node/extHostFileSystemEventService';
|
||||
@@ -398,6 +399,11 @@ export class ExtHostAPIImplementation {
|
||||
|
||||
let {wordPattern} = configuration;
|
||||
|
||||
// check for a valid word pattern
|
||||
if (wordPattern && regExpLeadsToEndlessLoop(wordPattern)) {
|
||||
throw new Error(`Invalid language configuration: wordPattern '${wordPattern}' is not allowed to match the empty string.`);
|
||||
}
|
||||
|
||||
// word definition
|
||||
if (wordPattern) {
|
||||
setWordDefinitionFor(modeId, wordPattern);
|
||||
|
||||
Reference in New Issue
Block a user