From: Michael Schroeder Date: Mon, 19 Feb 2018 10:51:44 +0000 (+0100) Subject: Work around rpm bug if HEADERIMPORT_FAST is used X-Git-Tag: 0.6.33~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d000c03eed2eee3838792cd7a177c40f7e941a79;p=thirdparty%2Flibsolv.git Work around rpm bug if HEADERIMPORT_FAST is used With HEADERIMPORT_FAST, rpm uses the difference between offsets to determine the entry length. Unfortunately, the length is used as entry count for RPM_BIN_TYPE, so the cound may end up to big. So trim it again to match the md5 length. Thanks to Oleg Girko for investigating this. --- diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index ee226e70..cd14a9b4 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -446,7 +446,12 @@ headstringarray(RpmHead *h, int tag, int *cnt) static unsigned char * headbinary(RpmHead *h, int tag, unsigned int *sizep) { - return headget(h, tag, (int *)sizep, 0); + unsigned char *b = headget(h, tag, (int *)sizep, 0); + if (b && sizep && (tag == TAG_SIGMD5 || tag == SIGTAG_MD5) && *sizep > 16) { + /* due to a bug in rpm the count may be bigger if HEADERIMPORT_FAST is used */ + *sizep = 16; + } + return b; } static int