8225292: Better Graphics2D drawing
Reviewed-by: serb, psadhukhan, mschoene, rhalade
--- a/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java Fri Jun 14 20:33:17 2019 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java Sun Jun 16 13:14:32 2019 -0700
@@ -3021,7 +3021,8 @@
if (data == null) {
throw new NullPointerException("char data is null");
}
- if (offset < 0 || length < 0 || offset + length > data.length) {
+ if (offset < 0 || length < 0 || offset + length < length ||
+ offset + length > data.length) {
throw new ArrayIndexOutOfBoundsException("bad offset/length");
}
if (font.hasLayoutAttributes()) {
@@ -3053,7 +3054,8 @@
if (data == null) {
throw new NullPointerException("byte data is null");
}
- if (offset < 0 || length < 0 || offset + length > data.length) {
+ if (offset < 0 || length < 0 || offset + length < length ||
+ offset + length > data.length) {
throw new ArrayIndexOutOfBoundsException("bad offset/length");
}
/* Byte data is interpreted as 8-bit ASCII. Re-use drawChars loops */