--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Wed Feb 09 11:50:29 2011 +0800
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Thu Feb 17 12:21:49 2011 +0300
@@ -1971,6 +1971,13 @@
return data->abortFlag;
}
+ if (cinfo->output_components <= 0 ||
+ cinfo->image_width > (0xffffffffu / (unsigned int)cinfo->output_components))
+ {
+ JNU_ThrowByName(env, "javax/imageio/IIOException",
+ "Invalid number of output components");
+ return data->abortFlag;
+ }
// Allocate a 1-scanline buffer
scanLinePtr = (JSAMPROW)malloc(cinfo->image_width*cinfo->output_components);
--- a/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp Wed Feb 09 11:50:29 2011 +0800
+++ b/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp Thu Feb 17 12:21:49 2011 +0300
@@ -186,7 +186,11 @@
jchar buffer[256];
jchar* chars = buffer;
if (len > 256) {
- chars = (jchar*)malloc(len * sizeof(jchar));
+ size_t size = len * sizeof(jchar);
+ if (size / sizeof(jchar) != len) {
+ return;
+ }
+ chars = (jchar*)malloc(size);
if (chars == 0) {
return;
}