You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (compressedStream== null || (compressedStream.length != width*height*depth/8)) {
logMessage("OpenJPEGJavaEncoder.encodeImageToJ2K: (re-)allocating " + (width*height*depth/8) + " bytes for the compressedStream");
compressedStream = newbyte[width*height*depth/8];
}
The current implementation of calculating the destination byte array size is buggy.
My test image has a size of 28000x7000x16. Because the calculation processes the operants from left to right, after multiplying the depth the calculated value creates an int overflow, which results in a negative destination array size. Simple brackets around the division of the depth by 8 should resolve this issue.
The text was updated successfully, but these errors were encountered:
openjpeg/wrapping/java/openjp2/java-sources/org/openJpeg/OpenJPEGJavaEncoder.java
Lines 121 to 124 in a589155
The current implementation of calculating the destination byte array size is buggy.
My test image has a size of 28000x7000x16. Because the calculation processes the operants from left to right, after multiplying the depth the calculated value creates an int overflow, which results in a negative destination array size. Simple brackets around the division of the depth by 8 should resolve this issue.
The text was updated successfully, but these errors were encountered: