mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8221307: String.substring() OOB exception on start index reports improper information
Reviewed-by: rriggs, redestad
This commit is contained in:
parent
a073e1261b
commit
c0b8844dce
3 changed files with 50 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -489,7 +489,7 @@ final class StringUTF16 {
|
|||
final char lo = Character.lowSurrogate(ch);
|
||||
checkBoundsBeginEnd(fromIndex, max, value);
|
||||
for (int i = fromIndex; i < max - 1; i++) {
|
||||
if (getChar(value, i) == hi && getChar(value, i + 1 ) == lo) {
|
||||
if (getChar(value, i) == hi && getChar(value, i + 1) == lo) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue