mirror of https://github.com/GNOME/gimp.git
Fix alleged problem with small TGA images
This commit is contained in:
parent
e284e94bfc
commit
b678992aeb
|
@ -1,3 +1,7 @@
|
|||
2000-11-18 Nick Lamb <njl195@zepler.org.uk>
|
||||
|
||||
* plug-ins/common/tga.c: Fix alleged problem with small images
|
||||
|
||||
2000-11-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* plug-ins/rcm/rcm_pixmaps.h: removed.
|
||||
|
|
|
@ -430,29 +430,26 @@ load_image (gchar *filename)
|
|||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
/* Check the footer. */
|
||||
if (fseek (fp, -26L, SEEK_END) ||
|
||||
fread (footer, sizeof (footer), 1, fp) != 1)
|
||||
{
|
||||
if (!fseek (fp, -26L, SEEK_END)) { /* Is file big enough for a footer? */
|
||||
if (fread (footer, sizeof (footer), 1, fp) != 1) {
|
||||
g_message (_("TGA: Cannot read footer from \"%s\"\n"), filename);
|
||||
return -1;
|
||||
}
|
||||
} else if (memcmp (footer + 8, magic, sizeof (magic)) == 0) {
|
||||
|
||||
/* Check the signature. */
|
||||
|
||||
/* Check the signature. */
|
||||
if (memcmp (footer + 8, magic, sizeof (magic)) == 0)
|
||||
{
|
||||
offset= footer[0] + (footer[1] * 256) + (footer[2] * 65536)
|
||||
+ (footer[3] * 16777216);
|
||||
|
||||
if (fseek (fp, offset, SEEK_SET) ||
|
||||
fread (extension, sizeof (extension), 1, fp) != 1)
|
||||
{
|
||||
fread (extension, sizeof (extension), 1, fp) != 1) {
|
||||
g_message (_("TGA: Cannot read extension from \"%s\"\n"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Eventually actually handle version 2 TGA here */
|
||||
}
|
||||
}
|
||||
|
||||
if (fseek (fp, 0, SEEK_SET) ||
|
||||
fread (header, sizeof (header), 1, fp) != 1)
|
||||
|
|
Loading…
Reference in New Issue