From 43be7abb70bef4e4e5cf09a5b397f21fca6d1c56 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 9 Aug 2018 20:48:25 +0200 Subject: [PATCH] closes https://github.com/assimp/assimp/issues/2088: fix possible out-of-bound access in fbx-lerp operaation. --- code/FBXConverter.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index c4b6c815f..701bd0562 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -2806,16 +2806,14 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs ) } void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs, - const aiVector3D& def_value, - double& max_time, - double& min_time ) - -{ - ai_assert( keys.size() ); - ai_assert( valOut ); + const aiVector3D& def_value, + double& max_time, + double& min_time ) { + ai_assert( !keys.empty() ); + ai_assert( nullptr != valOut ); std::vector next_pos; - const size_t count = inputs.size(); + const size_t count( inputs.size() ); next_pos.resize( inputs.size(), 0 ); @@ -2826,6 +2824,9 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c const KeyFrameList& kfl = inputs[ i ]; const size_t ksize = std::get<0>(kfl)->size(); + if (ksize == 0) { + continue; + } if ( ksize > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) == time ) { ++next_pos[ i ]; }