提交 a98ab885 编写于 作者: B bae

6829549: JVM crash on certain images

Reviewed-by: igor, prr
上级 1471ff4e
......@@ -41,6 +41,7 @@ import java.awt.Rectangle;
import java.awt.color.ColorSpace;
import java.awt.color.ICC_Profile;
import java.awt.color.ICC_ColorSpace;
import java.awt.color.CMMException;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
......@@ -629,6 +630,17 @@ public class JPEGImageReader extends ImageReader {
!java.util.Arrays.equals(oldData, newData))
{
iccCS = new ICC_ColorSpace(newProfile);
// verify new color space
try {
float[] colors = iccCS.fromRGB(new float[] {1f, 0f, 0f});
} catch (CMMException e) {
/*
* Embedded profile seems to be corrupted.
* Ignore this profile.
*/
iccCS = null;
warningOccurred(WARNING_IGNORE_INVALID_ICC);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册