changeset 13700:c20af8b7844d

8225292: Better Graphics2D drawing Reviewed-by: serb, psadhukhan, mschoene, rhalade
author prr
date Sun, 16 Jun 2019 13:14:32 -0700
parents 2c10a7ea0c40
children 932b59a0766b
files src/share/classes/sun/java2d/SunGraphics2D.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/java2d/SunGraphics2D.java	Wed Jun 19 15:24:42 2019 -0700
+++ b/src/share/classes/sun/java2d/SunGraphics2D.java	Sun Jun 16 13:14:32 2019 -0700
@@ -3020,7 +3020,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()) {
@@ -3052,7 +3053,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 */