8193444: SimpleDateFormat throws ArrayIndexOutOfBoundsException when format contains long sequences of unicode characters

Reviewed-by: naoto, rriggs
This commit is contained in:
Nishit Jain 2018-07-13 14:04:59 +05:30
parent a2a00af3c3
commit 0cb3d46cd7
2 changed files with 85 additions and 1 deletions

View file

@ -831,7 +831,7 @@ public class SimpleDateFormat extends DateFormat {
break;
}
}
compiledCode.append((char)(TAG_QUOTE_CHARS << 8 | (j - i)));
encode(TAG_QUOTE_CHARS, j - i, compiledCode);
for (; i < j; i++) {
compiledCode.append(pattern.charAt(i));
}