-
Bug
-
Resolution: Fixed
-
P5
-
9, 18, 19
-
b02
Methods toRGB, fromRGB, toCIEXYZ, and fromCIEXYZ of com.sun.imageio.plugins.common.BogusColorSpace class create a new array but return the original one. E.g., consider toRGB:
public float[] toRGB(float[] colorvalue) {
if(colorvalue.length < getNumComponents()) {
throw new ArrayIndexOutOfBoundsException
("colorvalue.length < getNumComponents()");
}
float[] rgbvalue = new float[3];
System.arraycopy(colorvalue, 0, rgbvalue, 0,
Math.min(3, getNumComponents()));
return colorvalue;
}
It returns colorvalue while rgbvalue should be returned instead. This may violate the specification of ColorSpace::toRGB as it states that an array of length 3 must be returned while the input array is not constrained and may have a different length. The same problem exists in other methods of this class.
public float[] toRGB(float[] colorvalue) {
if(colorvalue.length < getNumComponents()) {
throw new ArrayIndexOutOfBoundsException
("colorvalue.length < getNumComponents()");
}
float[] rgbvalue = new float[3];
System.arraycopy(colorvalue, 0, rgbvalue, 0,
Math.min(3, getNumComponents()));
return colorvalue;
}
It returns colorvalue while rgbvalue should be returned instead. This may violate the specification of ColorSpace::toRGB as it states that an array of length 3 must be returned while the input array is not constrained and may have a different length. The same problem exists in other methods of this class.