Bug 113661 - labelCompare segfaults if V or R is None
Summary: labelCompare segfaults if V or R is None
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-01-16 09:29 UTC by Paul Nasrat
Modified: 2014-01-21 22:48 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-02-20 20:11:16 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Error handling for V/R == None in labelCompare (574 bytes, patch)
2004-01-16 09:50 UTC, Paul Nasrat
no flags Details | Diff
This is the patch I'm putting into CVS (HEAD and rpm-4_3 branch) to fix the additional problem (1.44 KB, patch)
2004-02-20 20:08 UTC, Elliot Lee
no flags Details | Diff

Description Paul Nasrat 2004-01-16 09:29:32 UTC
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):

rpm-python-4.3-0.7


How reproducible:

Always

Steps to Reproduce:
1. Run following python fragment

import rpm
rpm.labelCompare(('1', None,'1'), ('1', '1', '1'))

  
Actual results:

Segfault

Expected results:

Segfault shouldn't occur.

Additional info:

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!)

Comment 1 Paul Nasrat 2004-01-16 09:50:26 UTC
Created attachment 97050 [details]
Error handling for V/R == None in labelCompare

Comment 2 Jeff Johnson 2004-01-26 09:56:23 UTC
Inspected, checked in. should be in rpm-4.3-0.9 when built.

Comment 3 Elliot Lee 2004-02-20 19:48:44 UTC
This breaks labelCompare behaviour compared to previous rpm versions.

Comment 4 Elliot Lee 2004-02-20 20:08:56 UTC
Created attachment 97884 [details]
This is the patch I'm putting into CVS (HEAD and rpm-4_3 branch) to fix the additional problem

Comment 5 Warren Togami 2004-02-21 22:02:41 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.