Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1411307823.4884.185.camel@eris.loria.fr>
Date: Sun, 21 Sep 2014 15:57:03 +0200
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Cc: Nadav Har'El <nyh@...udius-systems.com>
Subject: Re: Re: drand48() gives wrong sequence?

Am Sonntag, den 21.09.2014, 15:45 +0200 schrieb Jens Gustedt:
> Am Sonntag, den 21.09.2014, 14:27 +0100 schrieb Justin Cormack:
> > Hmm, just checked on a non-OSv Musl system and get the same result as
> > you. I also checked on NetBSD and FreeBSD and they give the same
> > result as glibc, so I think there must be a Musl bug.
> 
> In __rand48_step there is this line
> 
> 	x = xi[0] | xi[1]<<16 | xi[2]+0ULL<<32;
> 
> on arch with 16bit int this would be UB, no? Do we have such archs,
> still?

Thinking of it, it is UB even on platforms with 32bit if the high
order bit in the unsigned short is set. We then have

unsigned short --> int --> shifted value inside int --> unsigned long

So we better shouldn't do that in any case.

Jens

-- 
:: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::



Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.