mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8311906: Improve robustness of String constructors with mutable array inputs
Co-authored-by: Damon Fenacci <dfenacci@openjdk.org> Co-authored-by: Claes Redestad <redestad@openjdk.org> Co-authored-by: Amit Kumar <amitkumar@openjdk.org> Co-authored-by: Martin Doerr <mdoerr@openjdk.org> Reviewed-by: rgiulietti, thartmann, redestad, dfenacci
This commit is contained in:
parent
316b78336c
commit
155abc576a
15 changed files with 1300 additions and 248 deletions
|
@ -47,8 +47,12 @@ final class StringLatin1 {
|
|||
return (char)(value[index] & 0xff);
|
||||
}
|
||||
|
||||
public static boolean canEncode(char cp) {
|
||||
return cp <= 0xff;
|
||||
}
|
||||
|
||||
public static boolean canEncode(int cp) {
|
||||
return cp >>> 8 == 0;
|
||||
return cp >=0 && cp <= 0xff;
|
||||
}
|
||||
|
||||
public static int length(byte[] value) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue