diff options
author | Henning Dieterichs <notify.henning.dieterichs@live.de> | 2022-07-19 15:21:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-19 15:21:50 +0300 |
commit | 54375a03b87cbd97d6fd87cd006d66292d436029 (patch) | |
tree | f2028f4c331f0243ac8de91980dbaad80105d539 /src | |
parent | 5ae2a59a6d4a4a2707bfa2dc7969c1270a36c353 (diff) |
Fixes #152175 by limiting bracket query recursion depth to 200. (#155594)
Diffstat (limited to 'src')
-rw-r--r-- | src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.ts b/src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.ts index d4485d47cc4..9ea7e35847c 100644 --- a/src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.ts +++ b/src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.ts @@ -223,6 +223,10 @@ function collectBrackets( level: number, levelPerBracketType: Map<string, number> ): void { + if (level > 200) { + return; + } + if (node.kind === AstNodeKind.List) { for (const child of node.children) { nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length); @@ -333,6 +337,10 @@ function collectBracketPairs( level: number, levelPerBracketType: Map<string, number> ) { + if (level > 200) { + return; + } + if (node.kind === AstNodeKind.Pair) { let levelPerBracket = 0; if (levelPerBracketType) { |