Fix regression reading some old v4.0 era packages (#610)

Some old v4.0 era packages have RPMTAG_HEADERIMAGE in the signature
header region trailer, instead of the expected RPMTAG_HEADERSIGNATURES.
This was fixed in 4.4.x in commit 21818c6c8f
but regressed in the commit 85a5b00430
refactoring / cleanup.

Reported at https://bugzilla.altlinux.org/show_bug.cgi?id=33710, original
patch by Vladimir D. Seleznev.
This commit is contained in:
Panu Matilainen 2019-01-07 14:37:06 +02:00
parent 017d0b8846
commit 7a2f891d25
1 changed files with 3 additions and 0 deletions

View File

@ -1841,6 +1841,9 @@ static rpmRC hdrblobVerifyRegion(rpmTagVal regionTag, int exact_size,
ei2h(&trailer, &einfo);
/* Trailer offset is negative and has a special meaning */
einfo.offset = -einfo.offset;
/* Some old packages have HEADERIMAGE in signature region trailer, fix up */
if (regionTag == RPMTAG_HEADERSIGNATURES && einfo.tag == RPMTAG_HEADERIMAGE)
einfo.tag = RPMTAG_HEADERSIGNATURES;
if (!(einfo.tag == regionTag &&
einfo.type == REGION_TAG_TYPE && einfo.count == REGION_TAG_COUNT))
{