Fix crash when memory stream reading fails and perform soft error handling

#3612
This commit is contained in:
Wojtek Figat
2025-08-15 14:19:59 +02:00
parent 774b6bd72c
commit f21accd466
5 changed files with 10 additions and 6 deletions

View File

@@ -61,7 +61,11 @@ void MemoryReadStream::ReadBytes(void* data, uint32 bytes)
{
if (bytes > 0)
{
ASSERT(data && GetLength() - GetPosition() >= bytes);
if (!data || GetLength() - GetPosition() < bytes)
{
_hasError = true;
return;
}
Platform::MemoryCopy(data, _position, bytes);
_position += bytes;
}