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
I've found and issue with Hyperion related to stream reading.
I did not analyze carefully which line of code is failing (it seems, it serious issue related to StreamEx class). E.g. next code:
public static int ReadInt32(this Stream self, DeserializerSession session)
{
byte[] buffer = session.GetBuffer(4);
self.Read(buffer, 0, 4);
return BitConverter.ToInt32(buffer, 0);
}
self can return less than four bytes and it is normal situation (e.g. for network streams, or compressed streams), as result int value will be incorrect and other data will be garbage.
You need to replace read method to something like
public override int Read(byte[] buffer, int offset, int count)
{
var total = 0;
while (count > 0)
{
var cnt = _origStream.Read(buffer, offset, count);
offset += cnt;
count -= cnt;
total += cnt;
}
return total;
}
But only for places where you need to read specific count of bytes
The text was updated successfully, but these errors were encountered:
I've found and issue with Hyperion related to stream reading.
I did not analyze carefully which line of code is failing (it seems, it serious issue related to StreamEx class). E.g. next code:
self can return less than four bytes and it is normal situation (e.g. for network streams, or compressed streams), as result int value will be incorrect and other data will be garbage.
You need to replace read method to something like
But only for places where you need to read specific count of bytes
The text was updated successfully, but these errors were encountered: