changeset 41571:37e93ae74ab8

8159495: Fix Index Offsets Reviewed-by: flar, serb, mschoene
author prr
date Tue, 05 Jul 2016 10:29:31 -0700
parents 5b4a677ed287
children 0b3abcb3879a
files jdk/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceDataProxy.java jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c
diffstat 4 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java	Thu Jun 30 11:56:27 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java	Tue Jul 05 10:29:31 2016 -0700
@@ -102,10 +102,13 @@
                                            int w, int h)
     {
         if (cachedData == null) {
-            // Bitmask will be created lazily during the blit phase
-            cachedData = X11SurfaceData.createData(x11gc, w, h,
-                                                   x11gc.getColorModel(),
-                                                   null, 0, getTransparency());
+            try {
+                // Bitmask will be created lazily during the blit phase
+                cachedData = X11SurfaceData.createData(x11gc, w, h,
+                                                       x11gc.getColorModel(),
+                                                       null, 0, getTransparency());
+           } catch (OutOfMemoryError oome) {
+           }
         }
         return cachedData;
     }
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java	Thu Jun 30 11:56:27 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java	Tue Jul 05 10:29:31 2016 -0700
@@ -138,6 +138,9 @@
             vImg = (SunVolatileImage) dst.getGraphicsConfig().createCompatibleVolatileImage(w, h, src.getTransparency());
             vImg.setAccelerationPriority(1.0f);
 
+            if (!(vImg.getDestSurface() instanceof XRSurfaceData)) {
+                throw new InvalidPipeException("Could not create XRSurfaceData");
+            }
             if (src.getTransparency() == SurfaceData.OPAQUE) {
                 rgbTmpPM = new WeakReference<SunVolatileImage>(vImg);
             } else {
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceDataProxy.java	Thu Jun 30 11:56:27 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceDataProxy.java	Tue Jul 05 10:29:31 2016 -0700
@@ -59,9 +59,12 @@
     public SurfaceData validateSurfaceData(SurfaceData srcData,
             SurfaceData cachedData, int w, int h) {
         if (cachedData == null) {
-            cachedData = XRSurfaceData.createData(xrgc, w, h,
-                                                  xrgc.getColorModel(), null, 0,
-                                                  getTransparency(), true);
+            try {
+                cachedData = XRSurfaceData.createData(xrgc, w, h,
+                                                      xrgc.getColorModel(), null, 0,
+                                                      getTransparency(), true);
+            } catch (OutOfMemoryError oome) {
+            }
         }
         return cachedData;
     }
--- a/jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c	Thu Jun 30 11:56:27 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c	Tue Jul 05 10:29:31 2016 -0700
@@ -441,7 +441,7 @@
          * width , height must be nonzero otherwise XCreatePixmap
          * generates BadValue in error_handler
          */
-        if (width <= 0 || height <= 0) {
+        if (width <= 0 || height <= 0 || width > 32767 || height > 32767) {
             JNU_ThrowOutOfMemoryError(env,
                                   "Can't create offscreen surface");
             return JNI_FALSE;