You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2022/07/19 16:10:43 UTC
[hbase] branch master updated: HBASE-27219 Change JONI encoding in RegexStringComparator (#4632)
This is an automated email from the ASF dual-hosted git repository.
apurtell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new 075b3053cf0 HBASE-27219 Change JONI encoding in RegexStringComparator (#4632)
075b3053cf0 is described below
commit 075b3053cf0855cebde1ea618557ef026e593566
Author: Minwoo Kang <10...@users.noreply.github.com>
AuthorDate: Wed Jul 20 01:10:38 2022 +0900
HBASE-27219 Change JONI encoding in RegexStringComparator (#4632)
Signed-off-by: Andrew Purtell <ap...@apache.org>
---
.../java/org/apache/hadoop/hbase/filter/RegexStringComparator.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RegexStringComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RegexStringComparator.java
index 6841c80194a..4bdc057bd9e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RegexStringComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RegexStringComparator.java
@@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.apache.yetus.audience.InterfaceAudience;
import org.jcodings.Encoding;
import org.jcodings.EncodingDB;
-import org.jcodings.specific.UTF8Encoding;
+import org.jcodings.specific.NonStrictUTF8Encoding;
import org.joni.Matcher;
import org.joni.Option;
import org.joni.Regex;
@@ -312,7 +312,9 @@ public class RegexStringComparator extends ByteArrayComparable {
* NOTE: Only the {@link Pattern} flags CASE_INSENSITIVE, DOTALL, and MULTILINE are supported.
*/
static class JoniRegexEngine implements Engine {
- private Encoding encoding = UTF8Encoding.INSTANCE;
+ // When using UTF8Encoding, an infinite loop can occur if an invalid UTF8 is encountered.
+ // Use NonStrictUTF8Encoding instead of UTF8Encoding to avoid the issue.
+ private Encoding encoding = NonStrictUTF8Encoding.INSTANCE;
private String regex;
private Regex pattern;