Red Hat Bugzilla – Bug 113661
labelCompare segfaults if V or R is None
Last modified: 2014-01-21 17:48:44 EST
Description of problem:
Seth pointed this out to me, that if you parse a tuple with version
None (or release None) then you get a segfault.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Run following python fragment
rpm.labelCompare(('1', None,'1'), ('1', '1', '1'))
Segfault shouldn't occur.
Tested on a few different rpm versions.
Discussion with Seth and Owen Stampflee, basically rpmvercmp is being
called with NULL. Obviously same occurs using rpmlib/C directly.
I've added a check in header-py.c which will throw an exception, as I
think this should be handled by the caller rather than the library
function. Can you inspect before commit (once bitten!)
Created attachment 97050 [details]
Error handling for V/R == None in labelCompare
Inspected, checked in. should be in rpm-4.3-0.9 when built.
This breaks labelCompare behaviour compared to previous rpm versions.
Created attachment 97884 [details]
This is the patch I'm putting into CVS (HEAD and rpm-4_3 branch) to fix the additional problem
Note that the patch in comment #4 does not handle the case where Epoch
is undefined in both packages. Elliot checked in the fix to CVS
immediately after. See cvs.rpm.org for the newer fix.