closes https://github.com/assimp/assimp/issues/2088: fix possible out-of-bound access in fbx-lerp operaation.
parent
847573b9ed
commit
43be7abb70
|
@ -2806,16 +2806,14 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
|
||||||
}
|
}
|
||||||
|
|
||||||
void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
|
void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
|
||||||
const aiVector3D& def_value,
|
const aiVector3D& def_value,
|
||||||
double& max_time,
|
double& max_time,
|
||||||
double& min_time )
|
double& min_time ) {
|
||||||
|
ai_assert( !keys.empty() );
|
||||||
{
|
ai_assert( nullptr != valOut );
|
||||||
ai_assert( keys.size() );
|
|
||||||
ai_assert( valOut );
|
|
||||||
|
|
||||||
std::vector<unsigned int> next_pos;
|
std::vector<unsigned int> next_pos;
|
||||||
const size_t count = inputs.size();
|
const size_t count( inputs.size() );
|
||||||
|
|
||||||
next_pos.resize( inputs.size(), 0 );
|
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 KeyFrameList& kfl = inputs[ i ];
|
||||||
|
|
||||||
const size_t ksize = std::get<0>(kfl)->size();
|
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 ) {
|
if ( ksize > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) == time ) {
|
||||||
++next_pos[ i ];
|
++next_pos[ i ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue