Fix a bug where string erases throws out of range (#6135)

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
This commit is contained in:
Qingyou Zhao
2025-05-06 23:33:28 +02:00
committed by GitHub
co-authored by Kim Kulling
parent 0dafa03ff8
commit af352d6f7c
+3 -1
View File
@@ -300,7 +300,9 @@ bool PLY::Element::ParseElement(IOStreamBuffer<char> &streamBuffer, std::vector<
// the original string identifier
pOut->szName = std::string(&buffer[0], &buffer[0] + strlen(&buffer[0]));
auto pos = pOut->szName.find_last_of(' ');
pOut->szName.erase(pos, pOut->szName.size());
if (pos != std::string::npos) {
pOut->szName.erase(pos, pOut->szName.size());
}
}
if (!PLY::DOM::SkipSpaces(buffer))