<<< Date Index >>>     <<< Thread Index >>>

Re: [Mutt] #3439: Possible constraint violation or undefined behavior in mutt_srandom (init.c)



#3439: Possible constraint violation or undefined behavior in mutt_srandom
(init.c)
--------------------+-------------------------------------------------------
 Reporter:  vinc17  |       Owner:  mutt-dev
     Type:  defect  |      Status:  new     
 Priority:  major   |   Milestone:          
Component:  mutt    |     Version:          
 Keywords:          |  
--------------------+-------------------------------------------------------

Comment(by vinc17):

 Actually since long long is already used, the following would be OK:
 {{{
   seed = ((unsigned long long) tv.tv_sec << 20) | tv.tv_usec;
 }}}
 Note: unsigned long long guarantees that there is no overflow in the cast
 (if time_t is a floating type, this is important).

-- 
Ticket URL: <http://dev.mutt.org/trac/ticket/3439#comment:1>
Mutt <http://www.mutt.org/>
The Mutt mail user agent