7013519: [parfait] Integer overflows in 2D code
Reviewed-by: prr, valeriep
This commit is contained in:
parent
e8b79573d2
commit
0c700cc07d
@ -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
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user