From 7c8b9f19e9738ef69b7832e179aec37656175a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C5=A0ev=C4=8Denko?= Date: Wed, 5 Apr 2023 15:59:48 +0200 Subject: [PATCH] Update PathParser.java fixed string out of bounds bug --- .../java/com/typesafe/config/waterdrop/impl/PathParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/src/main/java/com/typesafe/config/waterdrop/impl/PathParser.java b/config/src/main/java/com/typesafe/config/waterdrop/impl/PathParser.java index 1edf039f3..191dc9e85 100644 --- a/config/src/main/java/com/typesafe/config/waterdrop/impl/PathParser.java +++ b/config/src/main/java/com/typesafe/config/waterdrop/impl/PathParser.java @@ -193,7 +193,7 @@ private static Collection splitTokenOnPeriod(Token t, ConfigSyntax flavor splitTokens.add(Tokens.newUnquotedText(t.origin(), ConfigParseOptions.pathTokenSeparator)); } - if (! tokenText.substring(tokenText.length() - ConfigParseOptions.pathTokenSeparator.length(), tokenText.length()).equals(ConfigParseOptions.pathTokenSeparator)) { + if (tokenText.length() < ConfigParseOptions.pathTokenSeparator.length() || ! tokenText.substring(tokenText.length() - ConfigParseOptions.pathTokenSeparator.length(), tokenText.length()).equals(ConfigParseOptions.pathTokenSeparator)) { splitTokens.remove(splitTokens.size() - 1); }