Prevent CMemoryFile to seek to a point before the start.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6348 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-04-20 21:57:25 +00:00
parent 3f2f98d7bd
commit 9504b3da21

View File

@ -52,14 +52,15 @@ bool CMemoryReadFile::seek(long finalPos, bool relativeMovement)
{
if (relativeMovement)
{
if (Pos + finalPos > Len)
const long newPos = Pos + finalPos;
if (newPos > Len || newPos < 0)
return false;
Pos += finalPos;
}
else
{
if (finalPos > Len)
if (finalPos > Len || finalPos < 0)
return false;
Pos = finalPos;