Skip to content
Snippets Groups Projects
Unverified Commit 3064af4d authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

fix(terraform): avoid oom parsing empty file (#12182)

parent 6fe49c6f
No related branches found
Tags 28.1.4
No related merge requests found
......@@ -36,7 +36,8 @@ export function extractTerraformProvider(
}
const line = lines[lineNumber];
if (line) {
// istanbul ignore next
if (is.string(line)) {
// `{` will be counted wit +1 and `}` with -1. Therefore if we reach braceCounter == 0. We have found the end of the terraform block
const openBrackets = (line.match(/\{/g) || []).length;
const closedBrackets = (line.match(/\}/g) || []).length;
......@@ -54,6 +55,9 @@ export function extractTerraformProvider(
}
}
}
} else {
// stop - something went wrong
braceCounter = 0;
}
lineNumber += 1;
} while (braceCounter !== 0);
......
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