Prevent infinite loop in `BinaryReader.ReadByteBuffer` extension

This commit is contained in:
James Groom 2024-05-17 09:06:48 +10:00 committed by GitHub
parent 51b64f63f1
commit 3c06face00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -171,6 +171,7 @@ namespace BizHawk.Common
while (len > 0)
{
var done = br.Read(ret, ofs, len);
if (done is 0) _ = br.ReadByte(); // triggers an EndOfStreamException (as there's otherwise no way to indicate this failure state to the caller)
ofs += done;
len -= done;
}