[MPlayer-dev-eng] Sign extension bug in stream_read_qword_le
Sean Veers
cf3cf3 at gmail.com
Sun Aug 19 02:00:31 CEST 2007
On 8/19/07, Reimar Döffinger wrote:
>
> 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.
>
Thanks, revised and tested patch attached.
Regards,
S
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stream_read_qword_le.patch
Type: text/x-patch
Size: 638 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070819/a939c7b2/attachment.bin>
More information about the MPlayer-dev-eng
mailing list