--- a/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java Mon Apr 08 21:12:28 2013 +0100
+++ b/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java Mon Apr 08 13:29:19 2013 -0700
@@ -654,9 +654,6 @@
") must be >= 0");
}
- int maxSize = 0;
- int size;
-
// we can be sure that width and height are greater than 0
if (scanlineStride < 0 ||
scanlineStride > (Integer.MAX_VALUE / height))
@@ -682,21 +679,23 @@
}
lastPixelOffset += lastScanOffset;
+ int index;
+ int maxIndex = 0;
for (int i = 0; i < numDataElements; i++) {
if (dataOffsets[i] > (Integer.MAX_VALUE - lastPixelOffset)) {
throw new RasterFormatException("Incorrect band offset: "
+ dataOffsets[i]);
}
- size = lastPixelOffset + dataOffsets[i];
+ index = lastPixelOffset + dataOffsets[i];
- if (size > maxSize) {
- maxSize = size;
+ if (index > maxIndex) {
+ maxIndex = index;
}
}
- if (data.length < maxSize) {
- throw new RasterFormatException("Data array too small (should be "
- + maxSize + " )");
+ if (data.length <= maxIndex) {
+ throw new RasterFormatException("Data array too small (should be > "
+ + maxIndex + " )");
}
}