Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private BufferedImage readImage(final PcxHeader pcxHeader, final InputStream is,
if ((pcxHeader.bitsPerPixel == 1 || pcxHeader.bitsPerPixel == 2 || pcxHeader.bitsPerPixel == 4 || pcxHeader.bitsPerPixel == 8)
&& pcxHeader.nPlanes == 1) {
final int bytesPerImageRow = (xSize * pcxHeader.bitsPerPixel + 7) / 8;
final byte[] image = Allocator.byteArray(ySize * bytesPerImageRow);
final byte[] image = Allocator.byteArray((long) ySize * bytesPerImageRow);
for (int y = 0; y < ySize; y++) {
rleReader.read(is, scanline);
System.arraycopy(scanline, 0, image, y * bytesPerImageRow, bytesPerImageRow);
Expand Down Expand Up @@ -370,7 +370,7 @@ private BufferedImage readImage(final PcxHeader pcxHeader, final InputStream is,
}
if (pcxHeader.bitsPerPixel == 8 && pcxHeader.nPlanes == 3) {
final byte[][] image = new byte[3][];
final int xySize = xSize * ySize;
final long xySize = (long) xSize * ySize;
image[0] = Allocator.byteArray(xySize);
image[1] = Allocator.byteArray(xySize);
image[2] = Allocator.byteArray(xySize);
Expand All @@ -390,7 +390,7 @@ private BufferedImage readImage(final PcxHeader pcxHeader, final InputStream is,
throw new ImagingException("Invalid/unsupported image with bitsPerPixel " + pcxHeader.bitsPerPixel + " and planes " + pcxHeader.nPlanes);
}
final int rowLength = 3 * xSize;
final byte[] image = Allocator.byteArray(rowLength * ySize);
final byte[] image = Allocator.byteArray((long) rowLength * ySize);
for (int y = 0; y < ySize; y++) {
rleReader.read(is, scanline);
if (pcxHeader.bitsPerPixel == 24) {
Expand Down