CB3DMeshFileLoader: abort if offsets point outside of file

fixes #70
This commit is contained in:
sfan5 2022-01-15 16:05:01 +01:00
parent 2fec5e5dd3
commit 195759100f

View File

@ -130,7 +130,8 @@ bool CB3DMeshFileLoader::load()
else
{
os::Printer::log("Unknown chunk found in mesh base - skipping");
B3DFile->seek(B3dStack.getLast().startposition + B3dStack.getLast().length);
if (!B3DFile->seek(B3dStack.getLast().startposition + B3dStack.getLast().length))
return false;
B3dStack.erase(B3dStack.size()-1);
}
}
@ -226,7 +227,8 @@ bool CB3DMeshFileLoader::readChunkNODE(CSkinnedMesh::SJoint *inJoint)
else
{
os::Printer::log("Unknown chunk found in node chunk - skipping");
B3DFile->seek(B3dStack.getLast().startposition + B3dStack.getLast().length);
if (!B3DFile->seek(B3dStack.getLast().startposition + B3dStack.getLast().length))
return false;
B3dStack.erase(B3dStack.size()-1);
}
}
@ -308,7 +310,8 @@ bool CB3DMeshFileLoader::readChunkMESH(CSkinnedMesh::SJoint *inJoint)
else
{
os::Printer::log("Unknown chunk found in mesh - skipping");
B3DFile->seek(B3dStack.getLast().startposition + B3dStack.getLast().length);
if (!B3DFile->seek(B3dStack.getLast().startposition + B3dStack.getLast().length))
return false;
B3dStack.erase(B3dStack.size()-1);
}
}