validate size values read from files before using them to allocate memory.

2007-07-06  Mukund Sivaraman  <muks@mukund.org>

        * plug-ins/common/sunras.c: validate size values read from files
        before using them to allocate memory.


svn path=/trunk/; revision=22885
This commit is contained in:
Mukund Sivaraman 2007-07-06 09:01:38 +00:00 committed by Mukund Sivaraman
parent 16970ab4f0
commit 2d6662cc95
2 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-07-06 Mukund Sivaraman <muks@mukund.org>
* plug-ins/common/sunras.c: validate size values read from files
before using them to allocate memory.
2007-07-06 Mukund Sivaraman <muks@mukund.org>
* plug-ins/common/psd-load.c: validate size values read from files

View File

@ -398,6 +398,11 @@ load_image (const gchar *filename)
return (-1);
}
if ((sunhdr.l_ras_maplength < 0) || (sunhdr.l_ras_maplength > (256 * 3)))
{
g_error ("Map lengths greater than 256 entries are unsupported by GIMP.");
}
/* Is there a RGB colourmap ? */
if ((sunhdr.l_ras_maptype == 1) && (sunhdr.l_ras_maplength > 0))
{