Skip to content

Commit

Permalink
Merge pull request #79 from ratmice/validate_meshtype
Browse files Browse the repository at this point in the history
* ratmice/validate_meshtype:
  PtexReader.cpp: validate mesh_type in header on open

Signed-off-by: David Aguilar <[email protected]>
  • Loading branch information
davvid committed Apr 30, 2024
2 parents a4524e4 + 3017a4c commit 4aa2c35
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ptex/PtexReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ bool PtexReader::open(const char* pathArg, Ptex::String& error)
closeFP();
return 0;
}
if (!(_header.meshtype == mt_triangle || _header.meshtype == mt_quad)) {
std::stringstream s;
s << "Invalid mesh type (" << _header.meshtype << "): " << pathArg;
error = s.str();
_ok = 0;
closeFP();
return 0;
}
_pixelsize = _header.pixelSize();
_errorPixel.resize(_pixelsize);

Expand Down

0 comments on commit 4aa2c35

Please sign in to comment.