[Bug 4405] New: expressions in include/archive.h (XZ magic) are undefined on big-endian architectures

bugzilla at busybox.net bugzilla at busybox.net
Sun Oct 30 15:49:04 UTC 2011


https://bugs.busybox.net/show_bug.cgi?id=4405

           Summary: expressions in include/archive.h (XZ magic) are
                    undefined on big-endian architectures
           Product: Busybox
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: mjt+busybox at tls.msk.ru
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


This place in particular:

        XZ_MAGIC1a  = 256 * (256 * (256 * 0xfd + '7') + 'z') + 'X',

it depends on the signedness of char datatype (all char constants here). 
Compiler produces the following warning:

In file included from archival/ar.c:31:0:
include/archive.h:17:20: warning: integer overflow in expression [-Woverflow]
  CC      archival/bbunzip.o

There's a debian bugreport about this, see http://bugs.debian.org/635370 .

Why not use computed numbers for all these magic numbers instead of
expressions, like

 XZ_MAGIC1a = 0xFD377A58UL

here and everywhere else around, like suggested in this debian bugreport?  This
makes things significantly more readable than it is now, both for little- and
for big-endian.

Thanks,

/mjt

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list