changeset 7559:141fd0bd0610

8041545: Better validation of generated rasters Reviewed-by: prr, serb, bae, skoivu
author pchelko
date Fri, 23 May 2014 12:03:24 +0400
parents 424f62904d32
children 654a386b6c32
files src/share/classes/sun/awt/image/BytePackedRaster.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/awt/image/BytePackedRaster.java	Thu May 22 22:14:55 2014 -0700
+++ b/src/share/classes/sun/awt/image/BytePackedRaster.java	Fri May 23 12:03:24 2014 +0400
@@ -1393,10 +1393,10 @@
             throw new RasterFormatException("Invalid scanline stride");
         }
 
-        int lastbit = (dataBitOffset
-                       + (height-1) * scanlineStride * 8
-                       + (width-1) * pixelBitStride
-                       + pixelBitStride - 1);
+        long lastbit = (long) dataBitOffset
+                       + (long) (height - 1) * (long) scanlineStride * 8
+                       + (long) (width - 1) * (long) pixelBitStride
+                       + (long) pixelBitStride - 1;
         if (lastbit < 0 || lastbit / 8 >= data.length) {
             throw new RasterFormatException("raster dimensions overflow " +
                                             "array bounds");