Bug 2192

Summary: Referencing out-of-bounds structures causes REPL crash
Product: ns-3 Reporter: bugzilla
Component: python bindingsAssignee: Gustavo J. A. M. Carneiro <gjcarneiro>
Status: NEW ---    
Severity: normal CC: ns-bugs
Priority: P5    
Version: ns-3-dev   
Hardware: Mac Intel   
OS: Mac OS   

Description bugzilla 2015-10-06 10:01:50 EDT
The following code will (eventually) cause the python REPL to crash. This behavior is reproducible (though sometimes multiple attempts / offsets are required):

Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ns.network
>>> nodes = ns.network.NodeContainer()
>>> nodes.Create(2)
>>> nodes.Get(356)
Segmentation fault: 11

Tested on ns-3-dev, changeset:   11678:cf9f06803ccb

Ref: https://groups.google.com/d/msg/ns-3-users/TX3d4tw4Ugs/hZQg__PUAAAJ

There are other commands that will crash the REPL as well, but I'll wait on guidance here before submitting.

Expected behavior: it would be nice if the out of bounds memory access were caught and handled either via exception or by returning None; crashing the underlying python process is probably not ideal behavior.