Bug 800138

Summary: Bug found in python-cryptsetup-0.1.4-2.fc17 using gcc-with-cpychecker static analyzer
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: cryptsetupAssignee: Milan Broz <mbroz>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: agk, mbroz, msivak, okozina, pvrabec
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-03-05/python-cryptsetup-0.1.4-2.fc17/
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-09 06:21:23 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 789472    

Description Dave Malcolm 2012-03-05 15:04:37 EST
Description of problem:
I've been writing an experimental static analysis tool to detect bugs commonly occurring within C Python extension modules:
  https://fedorahosted.org/gcc-python-plugin/
  http://gcc-python-plugin.readthedocs.org/en/latest/cpychecker.html
  http://fedoraproject.org/wiki/Features/StaticAnalysisOfPythonRefcounts

I ran the latest version of the tool (in git master; post 0.9) on
python-cryptsetup-0.1.4-2.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):
http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-03-05/python-cryptsetup-0.1.4-2.fc17/

I've manually reviewed the issue reported by the tool:
pycryptsetup/cryptsetup.c:passwordDialog:ob_refcnt of '*result' is 1 too high

This appears to be a reference leak for the case where PyArg_Parse fails (if the callback returns a value that isn't a string): it's missing a Py_DECREF(result) on that path.

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):
python-cryptsetup-0.1.4-2.fc17
gcc-python-plugin post-0.9 git 11462291a66c8db693c8884cb84b795bb5988ffb running the checker in an *f16* chroot
Comment 1 Milan Broz 2012-04-03 13:09:21 EDT
Dave, python-cryptsetup module moved to cryptsetup package and upstream is now submodule of cryptsetup itself (rpm is build as subrpm as well)

It was renamed to cryptsetup-python though. See
http://koji.fedoraproject.org/koji/buildinfo?buildID=284146

Can you try to run against version there? I think I fixed a lot of problems there already.
Comment 2 Milan Broz 2012-07-09 06:21:23 EDT
I think this was fixed in python module merge to cryptsetup.
If not, please reopen and provide logs for new version (see comment #1), thanks.