TMI-69: TIFFImageReader may throw IndexOutOfBoundsException if width not a multiple of tileWidth.

This commit is contained in:
Harald Kuhr
2014-10-16 14:42:49 +02:00
parent a8880e9dad
commit a5ce94957c
3 changed files with 8 additions and 3 deletions
@@ -634,10 +634,14 @@ public class TIFFImageReader extends ImageReaderBase {
: new LittleEndianDataInputStream(adapter);
}
// Read a full strip/tile
Raster clippedRow = clipRowToRect(rowRaster, srcRegion,
// Clip the stripTile rowRaster to not exceed the srcRegion
Rectangle clip = new Rectangle(srcRegion);
clip.width = Math.min((colsInTile + xSub - 1) / xSub, srcRegion.width);
Raster clippedRow = clipRowToRect(rowRaster, clip,
param != null ? param.getSourceBands() : null,
param != null ? param.getSourceXSubsampling() : 1);
// Read a full strip/tile
readStripTileData(clippedRow, srcRegion, xSub, ySub, numBands, interpretation, destRaster, col, row, colsInTile, rowsInTile, input);
if (abortRequested()) {