Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | From 19d7cc87adba92d31d5fafdf7db00920d24a96a6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alejandro del Castillo <alejandro.delcastillo@ni.com> |
| 3 | Date: Wed, 6 Feb 2019 13:24:04 -0600 |
| 4 | Subject: [PATCH] solver_solve: only disfavor recommends if there are any |
| 5 | |
| 6 | In a repo that have pkg 'a' and 'b' available, and 'b' is disfavored, |
| 7 | but 'a' doesn't recommend 'b', libsolv segfaults on |
| 8 | solver_addrecommendsrules, since solv->recommendsruleq is null. Only |
| 9 | call solver_addrecommendsrules if there are recommends rules. |
| 10 | |
| 11 | Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com> |
| 12 | |
| 13 | Upstream-Status: Accepted |
| 14 | --- |
| 15 | src/solver.c | 2 +- |
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 17 | |
| 18 | diff --git a/src/solver.c b/src/solver.c |
| 19 | index a80090d19..ad78327a8 100644 |
| 20 | --- a/src/solver.c |
| 21 | +++ b/src/solver.c |
| 22 | @@ -3920,7 +3920,7 @@ solver_solve(Solver *solv, Queue *job) |
| 23 | else |
| 24 | solv->yumobsrules = solv->yumobsrules_end = solv->nrules; |
| 25 | |
| 26 | - if (solv->havedisfavored && solv->strongrecommends) |
| 27 | + if (solv->havedisfavored && solv->strongrecommends && solv->recommendsruleq) |
| 28 | solver_addrecommendsrules(solv); |
| 29 | else |
| 30 | solv->recommendsrules = solv->recommendsrules_end = solv->nrules; |
| 31 | -- |
| 32 | 2.20.1 |
| 33 | |