aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-03-12 18:28:10 +0100
committersfan5 <sfan5@live.de>2021-03-12 18:28:10 +0100
commita3d848ff8b47bfe6b1649342a6ea54e095aa7af4 (patch)
treefcf0aceae0b8bf34cc34fa96cd224754f69a84fb
parent57ff34b1edb3e477b811ddf1165aa360a2e3eda6 (diff)
downloadirrlicht-a3d848ff8b47bfe6b1649342a6ea54e095aa7af4.tar.xz
CMemoryFile: fix seek bounds-checking
-rw-r--r--source/Irrlicht/CMemoryFile.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/Irrlicht/CMemoryFile.cpp b/source/Irrlicht/CMemoryFile.cpp
index 22c57e6..a214361 100644
--- a/source/Irrlicht/CMemoryFile.cpp
+++ b/source/Irrlicht/CMemoryFile.cpp
@@ -52,14 +52,14 @@ bool CMemoryReadFile::seek(long finalPos, bool relativeMovement)
{
if (relativeMovement)
{
- if (Pos + finalPos > Len)
+ if (Pos + finalPos < 0 || Pos + finalPos > Len)
return false;
Pos += finalPos;
}
else
{
- if (finalPos > Len)
+ if (finalPos < 0 || finalPos > Len)
return false;
Pos = finalPos;
@@ -133,14 +133,14 @@ bool CMemoryWriteFile::seek(long finalPos, bool relativeMovement)
{
if (relativeMovement)
{
- if (Pos + finalPos > Len)
+ if (Pos + finalPos < 0 || Pos + finalPos > Len)
return false;
Pos += finalPos;
}
else
{
- if (finalPos > Len)
+ if (finalPos < 0 || finalPos > Len)
return false;
Pos = finalPos;