Bug #2535

GlobalRoutingHelper - CalculateAllPossibleRoutes SEGFAULTS - fix included

Added by Christian Kreuzberger almost 4 years ago. Updated almost 4 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
0.50 h


When calling ndn::GlobalRoutingHelper::CalculateAllPossibleRoutes() I did sometimes receive SEGFAULTS or similar crashes (e.g., 300 nodes created with BRITE).
After using valgrind and gdb I identified the problem:

A vector is initialized with .size() elements, though in the for loop the index "faceNumber" is used, which is incremented BEFORE it is used.
Therefore, for the last face in this list, you create an invalid write.

The fix is rather easy: do not increment faceNumber until the end of the loop. I've attached a .diff file (and the full file) to this bug report.

patch.diff (1.45 KB) patch.diff Patch file for ndn-global-routing-helper.cpp Christian Kreuzberger, 02/18/2015 05:37 AM
ndn-global-routing-helper.cpp (12.8 KB) ndn-global-routing-helper.cpp Full NDN Global Routing Helper File Christian Kreuzberger, 02/18/2015 05:38 AM (3.56 KB) Code that will crash using ndnsim global routing helper Christian Kreuzberger, 02/18/2015 11:15 AM


#1 Updated by Spyros Mastorakis almost 4 years ago

  • Category changed from heper to helpers
  • Status changed from New to Code review
  • Assignee set to Spyros Mastorakis
  • % Done changed from 90 to 100

Originally reported by Christian Kreuzberger.

#2 Updated by Alex Afanasyev almost 4 years ago

Christian, can you post a sample scenario to verify expose the problem (and to verify that it was fixed)?

#3 Updated by Christian Kreuzberger almost 4 years ago

Here is an example (attached). It has something to do with the amount of faces you have on a certain node, hence the "arbitrary" construct of p2p links.

#4 Updated by Spyros Mastorakis almost 4 years ago

Christian thank you very much for the sample scenario.

@Alex, I confirm that before the fix on Ubuntu 14.04 I got a segmentation fault. After the patch, the scenario run successfully.
On OS X 10.10, I did not test before the patch. I tested after the patch, though, and the scenario run successfully.

#5 Updated by Spyros Mastorakis almost 4 years ago

  • Status changed from Code review to Closed

Also available in: Atom PDF