Fixing bug in tree structured VQ code that would generate nodes with redundant input vector indices, causing rare frontend verify crashes.

This commit is contained in:
Rich Geldreich
2021-09-22 20:09:16 -04:00
parent 3478338c7c
commit 716f6ee9dc

View File

@@ -1634,6 +1634,14 @@ namespace basisu
if ((!l_weight) || (!r_weight))
{
l_children.resize(0);
new_l_child.set(0.0f);
l_ttsum = 0.0f;
l_weight = 0;
r_children.resize(0);
new_r_child.set(0.0f);
r_ttsum = 0.0f;
r_weight = 0;
TrainingVectorType firstVec;
for (uint32_t i = 0; i < node.m_training_vecs.size(); i++)
{
@@ -1660,7 +1668,7 @@ namespace basisu
}
}
if (!l_weight)
if ((!l_weight) || (!r_weight))
return false;
}