[MPlayer-dev-eng] Sign extension bug in stream_read_qword_le
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Aug 19 00:48:08 CEST 2007
Hello,
On Sun, Aug 19, 2007 at 12:30:41AM +0200, Sean Veers wrote:
> --- mplayer-1.0-rc1svn20070812/stream/stream.h 2007-08-12
> 11:49:30.000000000 +0200
> +++ mplayer-1.0-rc1svn20070812/stream/stream.h 2007-08-18
> 21:30:09.775666044 +0200
> @@ -189,7 +189,7 @@ inline static uint64_t stream_read_qword_le
> y = stream_read_char(s);
> y|=stream_read_char(s)<<8;
> y|=stream_read_char(s)<<16;
> - y|=stream_read_char(s)<<24;
> + y|=(uint32_t)stream_read_char(s)<<24;
> y|=(uint64_t)stream_read_char(s)<<32;
> y|=(uint64_t)stream_read_char(s)<<40;
> y|=(uint64_t)stream_read_char(s)<<48;
I'd propose replacing this by
return stream_read_dword_le(s) | ((uint64_t)stream_read_dword_le(s) << 32);
(untested though).
Or the same with keeping y if you consider it more readable.
Greetings,
Reimar Döffinger
More information about the MPlayer-dev-eng
mailing list