8230829: Matcher matches a surrogate pair that crosses border of the region

Reviewed-by: naoto
This commit is contained in:
Ivan Gerasimov 2019-09-12 11:07:35 -07:00
parent e8ee2800f5
commit 5e7e0e7bbe
2 changed files with 24 additions and 6 deletions

View file

@ -3931,12 +3931,14 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
boolean match(Matcher matcher, int i, CharSequence seq) {
if (i < matcher.to) {
int ch = Character.codePointAt(seq, i);
return predicate.is(ch) &&
next.match(matcher, i + Character.charCount(ch), seq);
} else {
matcher.hitEnd = true;
return false;
i += Character.charCount(ch);
if (i <= matcher.to) {
return predicate.is(ch) &&
next.match(matcher, i, seq);
}
}
matcher.hitEnd = true;
return false;
}
boolean study(TreeInfo info) {
info.minLength++;