提交 cdafef64 编写于 作者: B bae

7013519: [parfait] Integer overflows in 2D code

Reviewed-by: prr, valeriep
上级 ec5aba66
...@@ -1971,6 +1971,13 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage ...@@ -1971,6 +1971,13 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage
return data->abortFlag; 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 // Allocate a 1-scanline buffer
scanLinePtr = (JSAMPROW)malloc(cinfo->image_width*cinfo->output_components); scanLinePtr = (JSAMPROW)malloc(cinfo->image_width*cinfo->output_components);
......
...@@ -186,7 +186,11 @@ JNIEXPORT void JNICALL Java_sun_font_SunLayoutEngine_nativeLayout ...@@ -186,7 +186,11 @@ JNIEXPORT void JNICALL Java_sun_font_SunLayoutEngine_nativeLayout
jchar buffer[256]; jchar buffer[256];
jchar* chars = buffer; jchar* chars = buffer;
if (len > 256) { 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) { if (chars == 0) {
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册