[xorg-bugzilla-noise] [Bug 1415] New: Xpm library doesn't build on LP64 platforms any more

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Sep 19 20:20:18 UTC 2004


Please do not reply to this email: if you want to comment on the bug, go to          
the URL shown below and enter yourcomments there.   
 
https://freedesktop.org/bugzilla/show_bug.cgi?id=1415        
   
           Summary: Xpm library doesn't build on LP64 platforms any more
           Product: xorg
           Version: unspecified
          Platform: PC
               URL: http://mail-index.netbsd.org/source-
                    changes/2004/09/19/0001.html
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Lib/Xpm
        AssignedTo: xorg-bugzilla-noise at freedesktop.org
        ReportedBy: tron at NetBSD.org


Building the Xpm library from X11R6.8.1 release doesn't build with GCC on LP64
platforms anymore:

/usr/xsrc/xfree/xc/extras/Xpm/lib/Attrib.c: In function `CreateOldColorTable':
/usr/xsrc/xfree/xc/extras/Xpm/lib/Attrib.c:55: warning: comparison is always fal
se due to limited range of data type
*** [Attrib.o] Error code 1

There are several incorrect code changes like this one:

static int
CreateOldColorTable(ct, ncolors, oldct)
    XpmColor *ct;
    unsigned int ncolors;
    XpmColor ***oldct;
{
[...]
    if (ncolors >= SIZE_MAX / sizeof(XpmColor *))
        return XpmNoMemory;

On LP64 platforms SIZE_MAX is defined to 2^64 - 1 while the maximum value of a
"unsigned int" is only 2^32 - 1. The code should therefore look like this:

static int
CreateOldColorTable(ct, ncolors, oldct)
    XpmColor *ct;
    unsigned int ncolors;
    XpmColor ***oldct;
{
[...]
    if (ncolors >= UINT_MAX / sizeof(XpmColor *))
        return XpmNoMemory;

I can provide a patch which the necessary fixes.        
   
   
--         
Configure bugmail: https://freedesktop.org/bugzilla/userprefs.cgi?tab=email       
   
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the xorg-bugzilla-noise mailing list