After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 122710 - Redundant comparison in io-tga.c
Redundant comparison in io-tga.c
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2003-09-19 10:20 UTC by Kjartan Maraas
Modified: 2010-07-10 04:04 UTC
See Also:
GNOME target: ---
GNOME version: 2.3/2.4



Description Kjartan Maraas 2003-09-19 10:20:52 UTC
I got this warning from gcc:

io-tga.c: In function `try_preload':
io-tga.c:720: warning: comparison is always false due to limited range of
data type

and it seems the compiler is right. The code is checking if a struct member
declared as guint8 is bigger than 255 here:

                        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;
                        }
Comment 1 Kjartan Maraas 2003-09-19 10:24:00 UTC
Same thing happens on line 931:

        if (hdr->infolen > 255) {
                g_set_error(err, GDK_PIXBUF_ERROR,
                            GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                            _("Too big value in the infolen field of
TGA header."));
                g_free(hdr);
                return NULL;
        }
Comment 2 Matthias Clasen 2003-09-19 19:20:35 UTC
Fixed on HEAD.