Ticket #17 (closed defect: fixed)
Various errors discovered using static analysis tool
|Reported by:||dmalcolm||Owned by:||twaugh|
I attempted to compile pycups (as seen in the Fedora packages) using a static analysis tool I've written for CPython extension code:
The signal:noise ratio of messages from the tool isn't yet as good as it could be (e.g. it tracebacks when analyzing some functions), but I believe I found some genuine bugs.
Specifically, there are quite a few places in the code where you do:
which is usually wrong (as it doesn't increment the refcount on that return value); typically you want to use this macro:
I will attach reports from the tool.
There are quite a few places where calls into Py_* functions could return NULL under low memory conditions, but the code assumes that the results are non-NULL (which will segfault). Are you aiming to make the code robust in this situation? (there are too many reports to sanely attach, alas)
Hope this is helpful