8225292: Better Graphics2D drawing

Reviewed-by: serb, psadhukhan, mschoene, rhalade
This commit is contained in:
Phil Race 2019-06-16 13:14:32 -07:00
parent c2701f73d5
commit 267eae16ae

View File

@ -3021,7 +3021,8 @@ public final class SunGraphics2D
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 @@ public final class SunGraphics2D
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 */