Skip to content

Commit f6291e5

Browse files
committed
fix: use Joni NonStrictUTF8Encoding to prevent potential infinite loops
See jruby/joni#17
1 parent 83e998c commit f6291e5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma

org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.eclipse.jdt.annotation.Nullable;
2626
import org.eclipse.tm4e.core.TMException;
2727
import org.eclipse.tm4e.core.internal.utils.StringUtils;
28-
import org.jcodings.specific.UTF8Encoding;
28+
import org.jcodings.specific.NonStrictUTF8Encoding;
2929
import org.joni.Matcher;
3030
import org.joni.Option;
3131
import org.joni.Regex;
@@ -88,7 +88,7 @@ private Regex parsePattern(final String pattern, final boolean ignoreCase) throw
8888
if (ignoreCase)
8989
options |= Option.IGNORECASE;
9090
final byte[] patternBytes = pattern.getBytes(StandardCharsets.UTF_8);
91-
return new Regex(patternBytes, 0, patternBytes.length, options, UTF8Encoding.INSTANCE, Syntax.DEFAULT,
91+
return new Regex(patternBytes, 0, patternBytes.length, options, NonStrictUTF8Encoding.INSTANCE, Syntax.RUBY,
9292
LOGGER.isLoggable(Level.WARNING) ? LOGGER_WARN_CALLBACK : WarnCallback.NONE);
9393
}
9494

0 commit comments

Comments
 (0)