1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0031274: Data Exchange - RWObj_Reader ignores usemtl with empty name

Fixed out of range access within pushMaterial().
This commit is contained in:
kgv
2019-12-25 19:36:48 +03:00
committed by bugmaster
parent 0da2ecac41
commit d415125a68
2 changed files with 61 additions and 6 deletions

View File

@@ -220,9 +220,9 @@ Standard_Boolean RWObj_Reader::read (const TCollection_AsciiString& theFile,
if (theToProbe)
{
if (::memcmp (aLine, "mtllib", 6) == 0)
if (::strncmp (aLine, "mtllib", 6) == 0)
{
readMaterialLib (aLine + 7);
readMaterialLib (IsSpace (aLine[6]) ? aLine + 7 : "");
}
else if (aLine[0] == 'v' && RWObj_Tools::isSpaceChar (aLine[1]))
{
@@ -269,13 +269,13 @@ Standard_Boolean RWObj_Reader::read (const TCollection_AsciiString& theFile,
{
pushObject (aLine + 2);
}
else if (::memcmp (aLine, "mtllib", 6) == 0)
else if (::strncmp (aLine, "mtllib", 6) == 0)
{
readMaterialLib (aLine + 7);
readMaterialLib (IsSpace (aLine[6]) ? aLine + 7 : "");
}
else if (::memcmp (aLine, "usemtl", 6) == 0)
else if (::strncmp (aLine, "usemtl", 6) == 0)
{
pushMaterial (aLine + 7);
pushMaterial (IsSpace (aLine[6]) ? aLine + 7 : "");
}
if (!checkMemory())