mirror of https://github.com/GNOME/gimp.git
use a signed variable when attempting to skip over unknown properties and
2006-07-10 Sven Neumann <sven@gimp.org> * app/xcf/xcf-load.c: use a signed variable when attempting to skip over unknown properties and check for EOF. Fixes bug #345802. * app/xcf/xcf-read.c: cleanup, nothing really changed
This commit is contained in:
parent
d8bb952f98
commit
ce1352cf7f
|
@ -1,3 +1,10 @@
|
|||
2006-07-10 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/xcf/xcf-load.c: use a signed variable when attempting to
|
||||
skip over unknown properties and check for EOF. Fixes bug #345802.
|
||||
|
||||
* app/xcf/xcf-read.c: cleanup, nothing really changed
|
||||
|
||||
2006-07-10 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tools/gimpdrawtool.c: documentation based on a patch from
|
||||
|
|
|
@ -519,8 +519,9 @@ xcf_load_image_props (XcfInfo *info,
|
|||
{
|
||||
if (base + prop_size != info->cp)
|
||||
{
|
||||
g_warning ("Mismatch in PROP_VECTORS size: skipping %d bytes.",
|
||||
base + prop_size - info->cp);
|
||||
g_printerr ("Mismatch in PROP_VECTORS size: "
|
||||
"skipping %d bytes.\n",
|
||||
base + prop_size - info->cp);
|
||||
xcf_seek_pos (info, base + prop_size, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -536,18 +537,22 @@ xcf_load_image_props (XcfInfo *info,
|
|||
|
||||
default:
|
||||
#ifdef GIMP_UNSTABLE
|
||||
g_printerr ("unexpected/unknown image property: %d (skipping)",
|
||||
g_printerr ("unexpected/unknown image property: %d (skipping)\n",
|
||||
prop_type);
|
||||
#endif
|
||||
{
|
||||
gsize size = prop_size;
|
||||
guint8 buf[16];
|
||||
guint amount;
|
||||
|
||||
while (prop_size > 0)
|
||||
while (size > 0)
|
||||
{
|
||||
amount = MIN (16, prop_size);
|
||||
if (feof (info->fp))
|
||||
return FALSE;
|
||||
|
||||
amount = MIN (16, size);
|
||||
info->cp += xcf_read_int8 (info->fp, buf, amount);
|
||||
prop_size -= MIN (16, amount);
|
||||
size -= MIN (16, amount);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -678,19 +683,23 @@ xcf_load_layer_props (XcfInfo *info,
|
|||
break;
|
||||
|
||||
default:
|
||||
#ifdef GIMP_UNSTABLE
|
||||
g_printerr ("unexpected/unknown layer property: %d (skipping)\n",
|
||||
prop_type);
|
||||
#endif
|
||||
{
|
||||
gsize size = prop_size;
|
||||
guint8 buf[16];
|
||||
guint amount;
|
||||
|
||||
#ifdef GIMP_UNSTABLE
|
||||
g_printerr ("unexpected/unknown layer property: %d (skipping)",
|
||||
prop_type);
|
||||
#endif
|
||||
while (prop_size > 0)
|
||||
while (size > 0)
|
||||
{
|
||||
amount = MIN (16, prop_size);
|
||||
if (feof (info->fp))
|
||||
return FALSE;
|
||||
|
||||
amount = MIN (16, size);
|
||||
info->cp += xcf_read_int8 (info->fp, buf, amount);
|
||||
prop_size -= MIN (16, amount);
|
||||
size -= MIN (16, amount);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -812,19 +821,22 @@ xcf_load_channel_props (XcfInfo *info,
|
|||
|
||||
default:
|
||||
#ifdef GIMP_UNSTABLE
|
||||
g_printerr ("unexpected/unknown channel property: %d (skipping)",
|
||||
g_printerr ("unexpected/unknown channel property: %d (skipping)\n",
|
||||
prop_type);
|
||||
#endif
|
||||
|
||||
{
|
||||
gsize size = prop_size;
|
||||
guint8 buf[16];
|
||||
guint amount;
|
||||
guint amount;
|
||||
|
||||
while (prop_size > 0)
|
||||
while (size > 0)
|
||||
{
|
||||
amount = MIN (16, prop_size);
|
||||
if (feof (info->fp))
|
||||
return FALSE;
|
||||
|
||||
amount = MIN (16, size);
|
||||
info->cp += xcf_read_int8 (info->fp, buf, amount);
|
||||
prop_size -= MIN (16, amount);
|
||||
size -= MIN (16, amount);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -34,9 +34,8 @@ xcf_read_int32 (FILE *fp,
|
|||
guint32 *data,
|
||||
gint count)
|
||||
{
|
||||
guint total;
|
||||
guint total = count;
|
||||
|
||||
total = count;
|
||||
if (count > 0)
|
||||
{
|
||||
xcf_read_int8 (fp, (guint8 *) data, count * 4);
|
||||
|
@ -64,15 +63,15 @@ xcf_read_int8 (FILE *fp,
|
|||
guint8 *data,
|
||||
gint count)
|
||||
{
|
||||
guint total;
|
||||
gint bytes;
|
||||
guint total = count;
|
||||
|
||||
total = count;
|
||||
while (count > 0)
|
||||
{
|
||||
bytes = fread ((char *) data, sizeof (char), count, fp);
|
||||
gint bytes = fread ((char *) data, sizeof (char), count, fp);
|
||||
|
||||
if (bytes <= 0) /* something bad happened */
|
||||
break;
|
||||
|
||||
count -= bytes;
|
||||
data += bytes;
|
||||
}
|
||||
|
@ -85,14 +84,15 @@ xcf_read_string (FILE *fp,
|
|||
gchar **data,
|
||||
gint count)
|
||||
{
|
||||
guint32 tmp;
|
||||
guint total;
|
||||
gint i;
|
||||
guint total = 0;
|
||||
gint i;
|
||||
|
||||
total = 0;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
guint32 tmp;
|
||||
|
||||
total += xcf_read_int32 (fp, &tmp, 1);
|
||||
|
||||
if (tmp > 0)
|
||||
{
|
||||
gchar *str;
|
||||
|
|
Loading…
Reference in New Issue