Skip to content

Commit

Permalink
fix: use Joni NonStrictUTF8Encoding to prevent potential infinite loops
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Jan 11, 2025
1 parent 83e998c commit f6291e5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tm4e.core.TMException;
import org.eclipse.tm4e.core.internal.utils.StringUtils;
import org.jcodings.specific.UTF8Encoding;
import org.jcodings.specific.NonStrictUTF8Encoding;
import org.joni.Matcher;
import org.joni.Option;
import org.joni.Regex;
Expand Down Expand Up @@ -88,7 +88,7 @@ private Regex parsePattern(final String pattern, final boolean ignoreCase) throw
if (ignoreCase)
options |= Option.IGNORECASE;
final byte[] patternBytes = pattern.getBytes(StandardCharsets.UTF_8);
return new Regex(patternBytes, 0, patternBytes.length, options, UTF8Encoding.INSTANCE, Syntax.DEFAULT,
return new Regex(patternBytes, 0, patternBytes.length, options, NonStrictUTF8Encoding.INSTANCE, Syntax.RUBY,
LOGGER.isLoggable(Level.WARNING) ? LOGGER_WARN_CALLBACK : WarnCallback.NONE);
}

Expand Down

0 comments on commit f6291e5

Please sign in to comment.