RPM Community Forums

Mailing List Message of <rpm-devel>

Re: damaged headers are due to FILESTATES RPM_CHAR_TYPE

From: Jeff Johnson <n3npq@mac.com>
Date: Wed 27 Aug 2008 - 15:16:50 CEST
Message-id: <6FFBB368-3FC0-4AA9-97AD-0E715E06B15E@mac.com>

On Aug 27, 2008, at 4:26 AM, Alexey Tourbin wrote:

> Damaged headers are due to FILESTATES from older rpmdb.
>
> rpmdb/header.c (regionSwab):
>    522      for (; il > 0; il--, pe++) {
>    523          struct indexEntry_s ie;
>    524          rpmTagType type;
>    525
>    526          ie.info.tag = (rpmuint32_t) ntohl(pe->tag);
>    527          ie.info.type = (rpmuint32_t) ntohl(pe->type);
>    528          ie.info.count = (rpmuint32_t) ntohl(pe->count);
>    529          ie.info.offset = (rpmint32_t) ntohl(pe->offset);
>    530  assert(ie.info.offset >= 0);    /* XXX insurance */
>    531
> Bails out right here:
>    532          if (hdrchkType(ie.info.type))
>    533              return 0;
>    534          if (hdrchkData(ie.info.count))
>    535              return 0;
>    536          if (hdrchkData(ie.info.offset))
>    537              return 0;
>    538          if (hdrchkAlign(ie.info.type, ie.info.offset))
>    539              return 0;
>
> Older FILESTATES have type RPM_CHAR_TYPE (= 1), and new value
> for RPM_MIN_TYPE is 2, which is RPM_UINT8_TYPE.


Nice catch! Changing RPM_MIN_TYPE back to 1 is the obvious fix.

However, I do wonder why this has not been reported before. AFAICT
the issue should have been very very loud and obvious.

What was the full calling context where the problem was seen?

73 de Jeff
Received on Wed Aug 27 15:17:58 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.