Skip to content

Commit

Permalink
Merge pull request assimp#5199 from sashashura/5513536726761472
Browse files Browse the repository at this point in the history
Fix UNKNOWN READ in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<ch
  • Loading branch information
kimkulling authored Aug 12, 2023
2 parents 461601e + e5d9339 commit 556c89b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/AssetLib/NDO/NDOLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/importerdesc.h>
#include <assimp/StreamReader.h>
#include <map>
#include <limits>

using namespace Assimp;

Expand Down Expand Up @@ -160,6 +161,9 @@ void NDOImporter::InternReadFile( const std::string& pFile,

temp = file_format >= 12 ? reader.GetU4() : reader.GetU2();
head = (const char*)reader.GetPtr();
if (std::numeric_limits<unsigned int>::max() - 76 < temp) {
throw DeadlyImportError("Invalid name length");
}
reader.IncPtr(temp + 76); /* skip unknown stuff */

obj.name = std::string(head, temp);
Expand Down

0 comments on commit 556c89b

Please sign in to comment.