提交 8e80a314 编写于 作者: P prr

8011248: Better Component Rasters

Reviewed-by: bae, vadim, mschoene
上级 794e99c0
......@@ -654,9 +654,6 @@ public class IntegerComponentRaster extends SunWritableRaster {
") 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 @@ public class IntegerComponentRaster extends SunWritableRaster {
}
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 + " )");
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册