]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix segfault in resolve_jobrules 443/head
authorThomas Lam <79589038+tl-hbk@users.noreply.github.com>
Tue, 30 Mar 2021 12:33:52 +0000 (05:33 -0700)
committerThomas Lam <79589038+tl-hbk@users.noreply.github.com>
Tue, 30 Mar 2021 12:36:40 +0000 (05:36 -0700)
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 9c02cc768d8b65cb12217055f9513fa1af56b67f..89a2ed10f85cf10c14ca9fa2053a8fccafd259dd 100644 (file)
@@ -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)