From: Thomas Lam <79589038+tl-hbk@users.noreply.github.com> Date: Tue, 30 Mar 2021 12:33:52 +0000 (-0700) Subject: Fix segfault in resolve_jobrules X-Git-Tag: 0.7.19~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F443%2Fhead;p=thirdparty%2Flibsolv.git Fix segfault in resolve_jobrules In selectandinstall sometimes rules are added and a realloc is required if there's no more memory available in the allocated block. r-- would just decrement the old pointer but the realloc could return a completely different block of memory --- diff --git a/src/solver.c b/src/solver.c index 9c02cc76..89a2ed10 100644 --- a/src/solver.c +++ b/src/solver.c @@ -1629,6 +1629,7 @@ resolve_jobrules(Solver *solv, int level, int disablerules, Queue *dq) } olevel = level; level = selectandinstall(solv, level, dq, disablerules, i, SOLVER_REASON_RESOLVE_JOB); + r = solv->rules + i; /* selectandinstall may have added more rules */ if (level <= olevel) { if (level == olevel)