Bug 2192 - Referencing out-of-bounds structures causes REPL crash
Referencing out-of-bounds structures causes REPL crash
Status: NEW
Product: ns-3
Classification: Unclassified
Component: python bindings
ns-3-dev
Mac Intel Mac OS
: P5 normal
Assigned To: Gustavo J. A. M. Carneiro
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-06 10:01 EDT by bugzilla
Modified: 2015-10-06 10:01 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.