[MPlayer-cvslog] CVS: main/libmpdemux demux_mpg.c,1.79,1.80

Rich Felker dalias at aerifal.cx
Thu May 4 03:45:01 CEST 2006


On Wed, May 03, 2006 at 07:55:05PM +0200, Nico Sabbi CVS wrote:
> CVS change done by Nico Sabbi CVS
> 
> Update of /cvsroot/mplayer/main/libmpdemux
> In directory mail:/var2/tmp/cvs-serv4850
> 
> Modified Files:
> 	demux_mpg.c 
> Log Message:
> in read_mpeg_timestamp() cast c to uint64_t or before << 30 will set a 1 in the sign bit with bad consequences

The fix is correct but the log message is NOT correct. The problem is
much bigger, you are truncating bits because you're shifting them out
the left! If x is type int, then x<<30 has only 4 possible values: 0,
0x40000000, 0x80000000, 0xc0000000. The upper bits are _lost_. They do
not become part of a new 64bit value unless you cast x to a 64bit type
before the shift.

Rich




More information about the MPlayer-cvslog mailing list