Skip to content

Commit 482472e

Browse files
committed
Fix crash in data association
Fix potential crash in mrpt::slam::data_association_full_covariance with JCBB when no individually compatible matching exists
1 parent 6877f5e commit 482472e

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

doc/doxygen-pages/changeLog_doc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
- RawLogViewer: Operation "convert to SF format" didn't take into account odometry observations.
8484
- Fix build errors with GCC 4.9
8585
- Fix crash of mrpt::hwdrivers::CIMUXSens_MT4's destructor when it fails to scan and open a device.
86+
- Fix potential crash in mrpt::slam::data_association_full_covariance with JCBB when no individually compatible matching exists [(commit)]()
8687
8788
<hr>
8889
<a name="1.1.0">

libs/slam/src/slam/data_association.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ double joint_pdf_metric (
7070
{
7171
// Make a list of the indices of the predictions that appear in "currentAssociation":
7272
const size_t N = info.currentAssociation.size();
73+
ASSERT_(N>0)
7374

7475
vector_size_t indices_pred(N); // Appearance order indices in the std::maps
7576
vector_size_t indices_obs(N);
@@ -166,7 +167,7 @@ void JCBB_recursive(
166167
info,
167168
results);
168169
}
169-
else if ( info.currentAssociation.size()==results.associations.size() )
170+
else if ( !info.currentAssociation.empty() && info.currentAssociation.size()==results.associations.size() )
170171
{
171172
// The same # of features matched than the previous best one... decide by better distance:
172173
const double d2 = joint_pdf_metric<T,METRIC>(

0 commit comments

Comments
 (0)