Fix environment arg parsing regex - avoid SO on the long strings

This commit is contained in:
Ilya Chernikov
2017-04-06 18:49:03 +02:00
parent 3552b94cdc
commit a19303e121
2 changed files with 6 additions and 3 deletions
@@ -423,7 +423,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
// <key> - is a single word (\w+ pattern)
// <value> - optionally quoted string with allowed escaped chars (only double-quote and backslash chars are supported)
// TODO: implement generic unescaping
val envParseRe = """(\w+)=(?:"((?:\\.|[^"])*)"|([^\s]*))""".toRegex()
val envParseRe = """(\w+)=(?:"([^"\\]*(\\.[^"\\]*)*)"|([^\s]*))""".toRegex()
val unescapeRe = """\\(["\\])""".toRegex()
if (arguments.scriptResolverEnvironment != null) {
for (envParam in arguments.scriptResolverEnvironment) {