mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8271732: Regression in StringBuilder.charAt bounds checking
Reviewed-by: alanb, naoto
This commit is contained in:
parent
ec2fc384e5
commit
a15b659278
3 changed files with 108 additions and 2 deletions
|
@ -349,10 +349,11 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
|
|||
*/
|
||||
@Override
|
||||
public char charAt(int index) {
|
||||
checkIndex(index, count);
|
||||
if (isLatin1()) {
|
||||
return StringLatin1.charAt(value, index);
|
||||
return (char)(value[index] & 0xff);
|
||||
}
|
||||
return StringUTF16.charAt(value, index);
|
||||
return StringUTF16.getChar(value, index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue