PCX: sanitize input data

Harden PCX plugin against bad width, height.
This commit is contained in:
Nils Philippsen 2009-12-01 15:31:52 +01:00
parent f3235e6f45
commit ed7f48be05
1 changed files with 7 additions and 0 deletions

View File

@ -405,6 +405,13 @@ load_image (const gchar *filename,
return -1;
}
/* Shield against potential buffer overflows in load_*() functions. */
if (G_MAXSIZE / width / height < 3)
{
g_message (_("Image dimensions too large: width %d x height %d"), width, height);
return -1;
}
if (pcx_header.planes == 3 && pcx_header.bpp == 8)
{
image= gimp_image_new (width, height, GIMP_RGB);