zeek / pysubnettree

A Python Module for CIDR Lookups
Other
51 stars 20 forks source link

segmentation fault on bad cidr #12

Closed sbentov closed 5 years ago

sbentov commented 5 years ago

the following is causing a segmentation fault on OSX:

In [1]: import SubnetTree
In [2]: t = SubnetTree.SubnetTree()
In [3]: t.insert('8.8.8.8/56')
Segmentation fault: 11

a bit more info:

  * frame #0: 0x000000010497b128 _SubnetTree.so`patricia_lookup + 200
    frame #1: 0x00000001049799bc _SubnetTree.so`SubnetTree::insert(int, _inx_addr, unsigned short, _object*) + 204
    frame #2: 0x0000000104979767 _SubnetTree.so`SubnetTree::insert(char const*, _object*) + 71
    frame #3: 0x000000010497d1f2 _SubnetTree.so`_wrap_SubnetTree_insert(_object*, _object*) + 370
jsiwek commented 5 years ago

Thanks for the report and patch, it's included (with some other extra error handling I added) in master and v0.29.