Red Hat Bugzilla – Bug 800126
Bugs found in pylibacl-0.5.0-4.fc17 using gcc-with-cpychecker static analyzer
Last modified: 2012-08-09 18:58:33 EDT
Description of problem:
I've been writing an experimental static analysis tool to detect bugs commonly occurring within C Python extension modules:
I ran the latest version of the tool (in git master; post 0.9) on
pylibacl-0.5.0-4.fc17.src.rpm, and it reports various errors.
You can see a list of errors here, triaged into categories (from most significant to least significant):
I've manually reviewed the issues reported by the tool.
Within the category "Unclassified errors" the 1 issue reported looks like a genuine bug: the Py_DECREF(format) at line 746 appears to be wrong, and could lead to "format" being deallocated before returning it.
Within the category "Reference count too low" the 1 issue reported appears to be the same issue as above.
Within the category "Reference leaks" the 2 issues reported appear to be genuine bugs:
acl.c:ACL_check:ob_refcnt of PyIntObject is 1 too high: suggest using:
Py_BuildValue("ii", result, eindex) instead, to avoid the leak (and the possibility of PyInt_FromLong failing).
acl.c:Entry_str:ob_refcnt of '*format' is 1 too high: this is missing a Py_DECREF(format) in the final error-handling path.
Within the category "Segfaults within error-handling paths" the 5 issues reported appear to be genuine bugs. Note that you can use Py_XDECREF() rather than Py_DECREF() if the pointer could be NULL.
Within the category "Possible reference leaks" the 1 issues reported looks like a memory leak, assuming that Permset_new() returns a new reference when it succeeds (rather than a borrowed reference).
There may of course be other bugs in my checker tool.
Hope this is helpful; let me know if you need help reading the logs that the tool generates - I know that it could use some improvement.
Version-Release number of selected component (if applicable):
gcc-python-plugin post-0.9 git 11462291a66c8db693c8884cb84b795bb5988ffb running the checker in an *f16* chroot
Hi Dave! Your tool looks very interesting. I will contact the author of pylibacl to allow him to take a look at the results.
Thanks a lot for this, it's very useful. I'll see about fixing the bugs and making a new release.
I'll probably need to build myself the same environment first, though…
I've released a new version; I believe it has fixed all reported issues.
Thanks Dave for this very nice tool!
pylibacl-0.5.1-2.fc17 has been submitted as an update for Fedora 17.
pylibacl-0.5.1-2.fc16 has been submitted as an update for Fedora 16.
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing pylibacl-0.5.1-2.fc17'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
pylibacl-0.5.1-2.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.