From 927c9cb3ce13203b18f93871f2326ae9046cca20 Mon Sep 17 00:00:00 2001 From: Marvin Pohl Date: Fri, 19 Jun 2015 14:04:30 +0100 Subject: [PATCH 1/2] Fixes random crash when loading fbx files --- code/FBXImporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/FBXImporter.cpp b/code/FBXImporter.cpp index 621868487..30f55fc34 100644 --- a/code/FBXImporter.cpp +++ b/code/FBXImporter.cpp @@ -151,9 +151,9 @@ void FBXImporter::InternReadFile( const std::string& pFile, // streaming for its output data structures so the net win with // streaming input data would be very low. std::vector contents; - contents.resize(stream->FileSize()); - - stream->Read(&*contents.begin(),contents.size(),1); + contents.resize(stream->FileSize()+1); + size_t readcnt = stream->Read( &*contents.begin(), 1, contents.size()-1 ); + contents[ contents.size() - 1 ] = 0; const char* const begin = &*contents.begin(); // broadphase tokenizing pass in which we identify the core From ff145bfac5da5d8ad89fe638a7ce3dc59c39b098 Mon Sep 17 00:00:00 2001 From: Marvin Pohl Date: Fri, 19 Jun 2015 14:24:34 +0100 Subject: [PATCH 2/2] Removed unused variable --- code/FBXImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/FBXImporter.cpp b/code/FBXImporter.cpp index 30f55fc34..c3dc57881 100644 --- a/code/FBXImporter.cpp +++ b/code/FBXImporter.cpp @@ -152,7 +152,7 @@ void FBXImporter::InternReadFile( const std::string& pFile, // streaming input data would be very low. std::vector contents; contents.resize(stream->FileSize()+1); - size_t readcnt = stream->Read( &*contents.begin(), 1, contents.size()-1 ); + stream->Read( &*contents.begin(), 1, contents.size()-1 ); contents[ contents.size() - 1 ] = 0; const char* const begin = &*contents.begin();