8340554: Improve MessageFormat readObject checks

Reviewed-by: naoto
This commit is contained in:
Justin Lu 2024-10-24 16:17:43 +00:00
parent 7d5eefa506
commit 7af46a6b42
2 changed files with 9 additions and 3 deletions

View file

@ -2041,7 +2041,7 @@ public class MessageFormat extends Format {
// Check the correctness of arguments and offsets
if (isValid) {
int lastOffset = patt.length() + 1;
int lastOffset = patt.length();
for (int i = maxOff; i >= 0; --i) {
if (argNums[i] < 0 || argNums[i] >= MAX_ARGUMENT_INDEX
|| offs[i] < 0 || offs[i] > lastOffset) {