Add bounds checks to the parsing utilities. (#5421)

* Add bounds checks to the parsing utilities.

* Fix merge conflicts in ACLoader.

* Fix loaders

* Fix unittest of AC-Loader.

* Remove dead code.

* Md5Parser fixes

* Fix md5-parsing

* Fix Merge conflict

* Fix merge conflicts.

* Md5: Fix warning: missing return statement.
This commit is contained in:
Kim Kulling
2024-01-30 14:32:41 +01:00
committed by GitHub
parent d5f35582d4
commit c08e3b4abb
39 changed files with 853 additions and 782 deletions

View File

@@ -159,7 +159,8 @@ void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
mBuffer = (unsigned char *)&mBuffer2[0];
char *szMe = (char *)&this->mBuffer[0];
SkipSpacesAndLineEnd(szMe, (const char **)&szMe);
const char *end = &mBuffer2[0] + mBuffer2.size();
SkipSpacesAndLineEnd(szMe, (const char **)&szMe, end);
// determine the format of the file data and construct the aiMesh
PLY::DOM sPlyDom;
@@ -167,7 +168,7 @@ void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
if (TokenMatch(szMe, "format", 6)) {
if (TokenMatch(szMe, "ascii", 5)) {
SkipLine(szMe, (const char **)&szMe);
SkipLine(szMe, (const char **)&szMe, end);
if (!PLY::DOM::ParseInstance(streamedBuffer, &sPlyDom, this)) {
if (mGeneratedMesh != nullptr) {
delete (mGeneratedMesh);