never allocate image->cmap smaller than GIMP_IMAGE_COLORMAP_SIZE. Fixes

2007-10-26  Michael Natterer  <mitch@gimp.org>

	* app/xcf/xcf-load.c (xcf_load_image_props): never allocate
	image->cmap smaller than GIMP_IMAGE_COLORMAP_SIZE.
	Fixes bug #490048.


svn path=/trunk/; revision=23954
This commit is contained in:
Michael Natterer 2007-10-26 09:48:07 +00:00 committed by Michael Natterer
parent 45361763c9
commit a3dea2cb23
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2007-10-26 Michael Natterer <mitch@gimp.org>
* app/xcf/xcf-load.c (xcf_load_image_props): never allocate
image->cmap smaller than GIMP_IMAGE_COLORMAP_SIZE.
Fixes bug #490048.
2007-10-26 Sven Neumann <sven@gimp.org>
* app/widgets/gimphistogrameditor.c

View File

@ -39,6 +39,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpgrid.h"
#include "core/gimpimage.h"
#include "core/gimpimage-colormap.h"
#include "core/gimpimage-grid.h"
#include "core/gimpimage-guides.h"
#include "core/gimpimage-sample-points.h"
@ -317,7 +318,7 @@ xcf_load_image_props (XcfInfo *info,
"Substituting grayscale map."));
info->cp +=
xcf_read_int32 (info->fp, (guint32 *) &image->num_cols, 1);
image->cmap = g_new (guchar, image->num_cols * 3);
image->cmap = g_new0 (guchar, GIMP_IMAGE_COLORMAP_SIZE);
if (!xcf_seek_pos (info, info->cp + image->num_cols, NULL))
return FALSE;
@ -332,7 +333,7 @@ xcf_load_image_props (XcfInfo *info,
{
info->cp +=
xcf_read_int32 (info->fp, (guint32 *) &image->num_cols, 1);
image->cmap = g_new (guchar, image->num_cols * 3);
image->cmap = g_new0 (guchar, GIMP_IMAGE_COLORMAP_SIZE);
info->cp +=
xcf_read_int8 (info->fp,
(guint8 *) image->cmap, image->num_cols * 3);