Project

General

Profile

Actions

Bug #2535

closed

GlobalRoutingHelper - CalculateAllPossibleRoutes SEGFAULTS - fix included

Added by Christian Kreuzberger about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Category:
helpers
Target version:
Start date:
02/18/2015
Due date:
% Done:

100%

Estimated time:
0.50 h

Description

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:
https://github.com/named-data/ndnSIM/blob/master/helper/ndn-global-routing-helper.cpp#L316-L320

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.


Files

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
ndn-routing-crash.cc (3.56 KB) ndn-routing-crash.cc Code that will crash using ndnsim global routing helper Christian Kreuzberger, 02/18/2015 11:15 AM
Actions

Also available in: Atom PDF