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>
|
2006-07-10 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/tools/gimpdrawtool.c: documentation based on a patch from
|
* app/tools/gimpdrawtool.c: documentation based on a patch from
|
||||||
|
|
|
@ -519,7 +519,8 @@ xcf_load_image_props (XcfInfo *info,
|
||||||
{
|
{
|
||||||
if (base + prop_size != info->cp)
|
if (base + prop_size != info->cp)
|
||||||
{
|
{
|
||||||
g_warning ("Mismatch in PROP_VECTORS size: skipping %d bytes.",
|
g_printerr ("Mismatch in PROP_VECTORS size: "
|
||||||
|
"skipping %d bytes.\n",
|
||||||
base + prop_size - info->cp);
|
base + prop_size - info->cp);
|
||||||
xcf_seek_pos (info, base + prop_size, NULL);
|
xcf_seek_pos (info, base + prop_size, NULL);
|
||||||
}
|
}
|
||||||
|
@ -536,18 +537,22 @@ xcf_load_image_props (XcfInfo *info,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef GIMP_UNSTABLE
|
#ifdef GIMP_UNSTABLE
|
||||||
g_printerr ("unexpected/unknown image property: %d (skipping)",
|
g_printerr ("unexpected/unknown image property: %d (skipping)\n",
|
||||||
prop_type);
|
prop_type);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
gsize size = prop_size;
|
||||||
guint8 buf[16];
|
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);
|
info->cp += xcf_read_int8 (info->fp, buf, amount);
|
||||||
prop_size -= MIN (16, amount);
|
size -= MIN (16, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -678,19 +683,23 @@ xcf_load_layer_props (XcfInfo *info,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
#ifdef GIMP_UNSTABLE
|
||||||
|
g_printerr ("unexpected/unknown layer property: %d (skipping)\n",
|
||||||
|
prop_type);
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
gsize size = prop_size;
|
||||||
guint8 buf[16];
|
guint8 buf[16];
|
||||||
guint amount;
|
guint amount;
|
||||||
|
|
||||||
#ifdef GIMP_UNSTABLE
|
while (size > 0)
|
||||||
g_printerr ("unexpected/unknown layer property: %d (skipping)",
|
|
||||||
prop_type);
|
|
||||||
#endif
|
|
||||||
while (prop_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);
|
info->cp += xcf_read_int8 (info->fp, buf, amount);
|
||||||
prop_size -= MIN (16, amount);
|
size -= MIN (16, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -812,19 +821,22 @@ xcf_load_channel_props (XcfInfo *info,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef GIMP_UNSTABLE
|
#ifdef GIMP_UNSTABLE
|
||||||
g_printerr ("unexpected/unknown channel property: %d (skipping)",
|
g_printerr ("unexpected/unknown channel property: %d (skipping)\n",
|
||||||
prop_type);
|
prop_type);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
|
gsize size = prop_size;
|
||||||
guint8 buf[16];
|
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);
|
info->cp += xcf_read_int8 (info->fp, buf, amount);
|
||||||
prop_size -= MIN (16, amount);
|
size -= MIN (16, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -34,9 +34,8 @@ xcf_read_int32 (FILE *fp,
|
||||||
guint32 *data,
|
guint32 *data,
|
||||||
gint count)
|
gint count)
|
||||||
{
|
{
|
||||||
guint total;
|
guint total = count;
|
||||||
|
|
||||||
total = count;
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
xcf_read_int8 (fp, (guint8 *) data, count * 4);
|
xcf_read_int8 (fp, (guint8 *) data, count * 4);
|
||||||
|
@ -64,15 +63,15 @@ xcf_read_int8 (FILE *fp,
|
||||||
guint8 *data,
|
guint8 *data,
|
||||||
gint count)
|
gint count)
|
||||||
{
|
{
|
||||||
guint total;
|
guint total = count;
|
||||||
gint bytes;
|
|
||||||
|
|
||||||
total = count;
|
|
||||||
while (count > 0)
|
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 */
|
if (bytes <= 0) /* something bad happened */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
count -= bytes;
|
count -= bytes;
|
||||||
data += bytes;
|
data += bytes;
|
||||||
}
|
}
|
||||||
|
@ -85,14 +84,15 @@ xcf_read_string (FILE *fp,
|
||||||
gchar **data,
|
gchar **data,
|
||||||
gint count)
|
gint count)
|
||||||
{
|
{
|
||||||
guint32 tmp;
|
guint total = 0;
|
||||||
guint total;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
total = 0;
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
guint32 tmp;
|
||||||
|
|
||||||
total += xcf_read_int32 (fp, &tmp, 1);
|
total += xcf_read_int32 (fp, &tmp, 1);
|
||||||
|
|
||||||
if (tmp > 0)
|
if (tmp > 0)
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
|
Loading…
Reference in New Issue