Re: Strangely useless code in io-tga.c, part of gdk-pixbuf



Doh! looks like it's been taken out of the latest io-tga.c

Chris

Chris Sherlock wrote:
Hi, I'm somewhat new to this group - so sorry if this question is OT, or I'm not following normal mailing list protocol, but I have a question about gdk-pixbuf.

I was looking through gdk-pixbuf and I found something odd. In io-tga.c,
there's the following code snippet:

if (ctx->hdr->infolen > 255) {
  g_set_error(err, GDK_PIXBUF_ERROR,
                   GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                   _("TGA image comment length is too long"));
  return FALSE;
}


There's also another code segment that does the same check.

I don't get it! infolen is an element of _TGAHeader, and is declared as
a guint8. Isn't guint8 *gauranteed* to be an unsigned integer that's one
byte long?

If this is the case, this code check really isn't needed... so why is it
in there?

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]