Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1654 - rpm 2.5.5-5.2: rpmReadPackageHeader gives wrong return value when getting a corrupt package.
Summary: rpm 2.5.5-5.2: rpmReadPackageHeader gives wrong return value when getting a c...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 5.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: David Lawrence
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-03-21 22:30 UTC by bvermeul
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-03-21 23:44:56 UTC


Attachments (Terms of Use)

Description bvermeul 1999-03-21 22:30:14 UTC
When rpmReadPackageHeader is called for a corrupt or 0 sized
package (touch bla-1.1-1.i386.rpm does nicely), it doesn't
signal an error. According to the docs (Maximum RPM) it
should return 0 when succesful, 1 when it finds bad magic
numbers, and 2 when another error occurs. When calling
rpmReadPackageHeader on the empty rpm, it returns 0, and it
sets the isSource flag. When headerFree is called on the
resulting Header variable, it segfaults.

Comment 1 Jeff Johnson 1999-03-21 23:03:59 UTC
This program prints "rc 1" using rpm-2.93-1 on sparc Red Hat 5.2.
A perusal of the latest rpm-2.5.x sources indicates that 1 is
what would be expected.

#include <rpm/rpmlib.h>

main()
{
        FD_t fd;
        Header h;
        int isSource;
        int rc;

        fd = fdOpen("/tmp/foo.src.rpm", 0, 0);
        rc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL);
        printf("rc %d\n", rc, isSource);
}

Comment 2 bvermeul 1999-03-21 23:26:59 UTC
You're absolutely right. I interpreted the code wrong. Sorry 'bout
that.


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