]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix segfault in resolve_jobrules
authorThomas Lam <79589038+tl-hbk@users.noreply.github.com>
Tue, 30 Mar 2021 12:33:52 +0000 (05:33 -0700)
committerMichael Schroeder <mls@suse.de>
Thu, 20 May 2021 10:00:55 +0000 (12:00 +0200)
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

src/solver.c

index 4485da63c873ef1bccc27be99c31e79d92dc5250..70438e2d11a8fc3b249744b2afbb61ca9c9de895 100644 (file)
@@ -1596,6 +1596,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)