[Bug 6191] New: Mercurial fails to clone on big-endian arches

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Mon Aug 26 18:07:52 UTC 2019


https://bz.mercurial-scm.org/show_bug.cgi?id=6191

            Bug ID: 6191
           Summary: Mercurial fails to clone on big-endian arches
           Product: Mercurial
           Version: default branch
          Hardware: Other
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: mplch at redhat.com
                CC: mercurial-devel at mercurial-scm.org

safeadd in mercurial/mpatch.c casts its arguments to int.
On big endian arches, if safeadd is called with a 64-bit type (e.g. a pointer)
the compiler passes wrong end of the pointer to the function.

This means decode() in mercurial/mpatch.c has no way to work properly.

Binary visualisation from a specific case on an s390x system:

(gdb) p /t bin
# note that I have added a leading zero for better readability
$4 = 0111111111111110110101101000010101100010000
(gdb) p /t lt->len
$5 = 101001
(gdb) n 
303                     if (!safeadd(lt->len, &bin)) {
(gdb) p /t bin
$6 = 1000010100011110110101101000010101100010000

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list