You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.
According to MSDN documentation for System.IO.Stream.ReadByte(), the return value should be an unsigned byte cast to an Int32, or -1 if at the end of the stream.
However, the DataStream.ReadByte() is casting a signed byte to an Int32, which makes it produce wrong return values for bytes in the range of 0xf0...0xff.
Especially, a 0xff byte will be returned as -1 (instead of 255, as it should be) and thus incorrectly indicate end of stream.
To fix this bug, cast the result explicitly as a byte when returning, like:
return (byte) _buffer[_position++];
The text was updated successfully, but these errors were encountered:
According to MSDN documentation for System.IO.Stream.ReadByte(), the return value should be an unsigned byte cast to an Int32, or -1 if at the end of the stream.
However, the DataStream.ReadByte() is casting a signed byte to an Int32, which makes it produce wrong return values for bytes in the range of 0xf0...0xff.
Especially, a 0xff byte will be returned as -1 (instead of 255, as it should be) and thus incorrectly indicate end of stream.
To fix this bug, cast the result explicitly as a byte when returning, like:
The text was updated successfully, but these errors were encountered: