From 2922753589567c066d0a9721b14d04820c688566 Mon Sep 17 00:00:00 2001 From: Daniel Hritzkiv Date: Fri, 3 Nov 2017 11:50:28 -0400 Subject: [PATCH] Return early when element is TextureFile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In cases where the TextureFile name would start with an integer, `strtoul10` would parse that number and incorrectly set `numOccur` to that number. This caused PLY parsing to fail for vertex positions. Since TextureFile is a single line, and does not have any follow-up lines, it’s okay to return early --- code/PlyParser.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index f4b68a83f..65de665ab 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -381,6 +381,11 @@ bool PLY::Element::ParseElement(IOStreamBuffer &streamBuffer, std::vector< { char* endPos = &buffer[0] + (strlen(&buffer[0]) - 1); pOut->szName = std::string(&buffer[0], endPos); + + // go to the next line + PLY::DOM::SkipSpacesAndLineEnd(buffer); + + return true; } //parse the number of occurrences of this element @@ -933,7 +938,7 @@ bool PLY::PropertyInstance::ParseValue(const char* &pCur, { ai_assert(NULL != pCur); ai_assert(NULL != out); - + //calc element size bool ret = true; switch (eType)