PlyLoader: Fix operator precedence issue in header check
The previous version might read past end of bufferpull/1444/head
parent
4652be8f18
commit
b74fc9495a
|
@ -170,9 +170,10 @@ void PLYImporter::InternReadFile(const std::string& pFile,
|
|||
std::vector<char> headerCheck;
|
||||
streamedBuffer.getNextLine(headerCheck);
|
||||
|
||||
if ((headerCheck.size() >= 3) && (headerCheck[0] != 'P' && headerCheck[0] != 'p') ||
|
||||
(headerCheck[1] != 'L' && headerCheck[1] != 'l') ||
|
||||
(headerCheck[2] != 'Y' && headerCheck[2] != 'y'))
|
||||
if ((headerCheck.size() < 3) ||
|
||||
(headerCheck[0] != 'P' && headerCheck[0] != 'p') ||
|
||||
(headerCheck[1] != 'L' && headerCheck[1] != 'l') ||
|
||||
(headerCheck[2] != 'Y' && headerCheck[2] != 'y') )
|
||||
{
|
||||
streamedBuffer.close();
|
||||
throw DeadlyImportError("Invalid .ply file: Magic number \'ply\' is no there");
|
||||
|
|
Loading…
Reference in New Issue