Closed dfn-certling closed 1 year ago
Thanks @dfn-certling ,
Our Segfault from https://github.com/zeek/pysubnettree/issues/19 is back. This time being reproducible, I found the likely culprit.
Do you have a minimal reproducer to trigger this? I've tried reproducing it here on Debian 12 with Python 3.11 and in an Ubuntu 20.04 container, but no dice so far.
I understand you mainly suggest to regenerate the _wrap.cc
file and do a new release, but would prefer to be able to trigger the crash here, too.
Ah, got it. Using a unicode string that cannot be converted to ASCII.
docker run --rm -it --entrypoint=/bin/bash python:3.11
root@495f2c2a5041:/# pip install pysubnettree
root@495f2c2a5041:/# python3 -c 'import SubnetTree; t = SubnetTree.SubnetTree(); "üüpps" in t'
Segmentation fault (core dumped)
That's another symptom, yes, as before #14 the return value seems to not have been checked.
Our Segfault from #19 is back. This time being reproducible, I found the likely culprit.
The fix from #14 was only applied to the SWIG input file. The generated SWIG wrappers are unchanged in the repo and also in the Source-Tarballs in PyPI. Looking at SubnetTree_wrap.cc shows the reference count of
ascii
being decremented before calling the lookup functions in the contains-Wrappers.Just installing the package with
python3 setup,py install
does not recreate the wrappers and just installs the pre #14 version susceptible to the Segfault. Removing the wrappers and recreating them withfixes the Segfault for us.