LWS-Import: Avoid access to empty string token

- Fix invalid access to string pointer when string token is empty
- closes https://github.com/assimp/assimp/issues/4222
pull/4283/head
Kim Kulling 2021-12-22 21:08:28 +01:00 committed by GitHub
parent 7ec52e9e02
commit 635153b3a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -537,6 +537,11 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// get file format version and print to log // get file format version and print to log
++it; ++it;
if ((*it).tokens[0].empty()) {
ASSIMP_LOG_ERROR("Invalid LWS file detectedm abort import.");
return;
}
unsigned int version = strtoul10((*it).tokens[0].c_str()); unsigned int version = strtoul10((*it).tokens[0].c_str());
ASSIMP_LOG_INFO("LWS file format version is ", (*it).tokens[0]); ASSIMP_LOG_INFO("LWS file format version is ", (*it).tokens[0]);
first = 0.; first = 0.;