From 5f404df5d508a7058d6d390f63115c2efccdc54e Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Mon, 13 Jan 2014 18:25:50 +0100 Subject: [PATCH] make addfilelist more resistant against corrupt rpms --- ext/repo_rpmdb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index dea9305b..b3da6bdd 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -704,7 +704,7 @@ adddudata(Repodata *data, Id handle, RpmHead *rpmhead, char **dn, unsigned int * for (i = 0; i < fc; i++) { if (di[i] >= dc) - continue; + continue; /* corrupt entry */ fn[di[i]]++; if (fsz[i] == 0 || !S_ISREG(fm[i])) continue; @@ -742,7 +742,7 @@ addfilelist(Repodata *data, Id handle, RpmHead *rpmhead) int bnc, dnc, dic; int i; Id lastdid = 0; - int lastdii = -1; + unsigned int lastdii = -1; if (!data) return; @@ -779,6 +779,8 @@ addfilelist(Repodata *data, Id handle, RpmHead *rpmhead) did = lastdid; else { + if (di[i] >= dnc) + continue; /* corrupt entry */ did = repodata_str2dir(data, dn[di[i]], 1); if (!did) did = repodata_str2dir(data, "/", 1); -- 2.47.2