8283325: US_ASCII decoder relies on String.decodeASCII being exhaustive

Reviewed-by: rriggs, dcubed
This commit is contained in:
Claes Redestad 2022-03-17 21:15:36 +00:00
parent b004fb0550
commit 002e366744
2 changed files with 61 additions and 0 deletions

View file

@ -1032,6 +1032,12 @@ public final class String
/* package-private */
static int decodeASCII(byte[] sa, int sp, char[] da, int dp, int len) {
int count = StringCoding.countPositives(sa, sp, len);
while (count < len) {
if (sa[sp + count] < 0) {
break;
}
count++;
}
StringLatin1.inflate(sa, sp, da, dp, count);
return count;
}