don't get stuck in _wordenize, don't allow evil regexp as word definition, fixes #3963

This commit is contained in:
Johannes Rieken
2016-03-11 10:51:50 +01:00
parent 6d312fe8ce
commit 31950e91b9
2 changed files with 10 additions and 0 deletions

View File

@@ -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);