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

Re: coturn 4.5.0.7-1: FTBFS, alignment problem



Hello!

I ran the binary through gdb on sparc64 and my backtrace looks
like this:

(gdb) bt
#0  0x000001000000d0e0 in encode_oauth_token_gcm (server_name=0x7feffffebd8 "blackdow.carleon.gov", etoken=0x7feffffe4b8, key=0x7feffffe100, dtoken=0x7feffffdbf0, 
    nonce0=0x7feffffeb78 "h4j3k2l2n4b5") at src/ns_turn_defs.h:98
#1  0x0000010000003778 in check_oauth () at src/apps/rfc5769/rfc5769check.c:146
#2  main (argc=<optimized out>, argv=<optimized out>) at src/apps/rfc5769/rfc5769check.c:568
(gdb)

Looking at the source code, it's very obvious that what's done
in _ioa_ntoh64() is not particularly safe:

#define nswap16(s) ntohs(s)
#define nswap32(ul) ntohl(ul)
#define nswap64(ull) ioa_ntoh64(ull)

static inline u64bits _ioa_ntoh64(u64bits v)
{
#if BYTE_ORDER == LITTLE_ENDIAN
        u08bits *src = (u08bits*) &v;
        u08bits* dst = src + 7;
        while (src < dst) {
                u08bits vdst = *dst;
                *(dst--) = *src;
                *(src++) = vdst;
        }
#elif BYTE_ORDER == BIG_ENDIAN
        /* OK */
#else
#error WRONG BYTE_ORDER SETTING
#endif
        return v;
}

The easiest way to repair it would be to replace the assignments
with memcpy().

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


Reply to: