diff -urN rpm-5.4.10/lib/depends.c rpm-5.4.10-patched/lib/depends.c --- rpm-5.4.10/lib/depends.c 2012-04-16 08:20:56.000000000 +1100 +++ rpm-5.4.10-patched/lib/depends.c 2017-01-24 22:01:08.293412374 +1000 @@ -58,7 +58,13 @@ { const uint32_t * aptr = (const uint32_t *) a; const uint32_t * bptr = (const uint32_t *) b; - int rc = (*aptr - *bptr); + int rc; + if (*aptr > *bptr) + rc = 1; + else if (*aptr < *bptr) + rc = -1; + else + rc = 0; return rc; } diff -urN rpm-5.4.10/lib/rpmts.c rpm-5.4.10-patched/lib/rpmts.c --- rpm-5.4.10/lib/rpmts.c 2012-04-16 08:20:58.000000000 +1100 +++ rpm-5.4.10-patched/lib/rpmts.c 2017-01-24 22:00:48.517412898 +1000 @@ -1211,20 +1211,32 @@ */ case FA_CREATE: dsi->bneeded += bneeded; - dsi->bneeded -= BLOCK_ROUND(prevSize, dsi->f_bsize); + bneeded = BLOCK_ROUND(prevSize, dsi->f_bsize); + if (dsi->bneeded > bneeded) + dsi->bneeded -= bneeded; + else + dsi->bneeded = 0; /*@switchbreak@*/ break; case FA_ERASE: dsi->ineeded--; - dsi->bneeded -= bneeded; + if (dsi->bneeded > bneeded) + dsi->bneeded -= bneeded; + else + dsi->bneeded = 0; /*@switchbreak@*/ break; default: /*@switchbreak@*/ break; } - if (fixupSize) - dsi->bneeded -= BLOCK_ROUND(fixupSize, dsi->f_bsize); + if (fixupSize) { + bneeded = BLOCK_ROUND(fixupSize, dsi->f_bsize); + if (dsi->bneeded > bneeded) + dsi->bneeded -= bneeded; + else + dsi->bneeded = 0; + } } void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)