From 02b1bdeed0686cc553315d34fba62782b4e77426 Mon Sep 17 00:00:00 2001 From: zjay998 Date: Tue, 11 Oct 2022 18:54:18 +0800 Subject: [PATCH] Sync upstream patches (cherry picked from commit 31e4ae2574222affc118073cb80aac0c30977025) --- ...when-using-testsolv-to-execute-cases.patch | 29 ++++++++++++++++++ ...conflict-resolution-when-using-bindi.patch | 30 +++++++++++++++++++ libsolv.spec | 12 +++++++- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 Fix-memory-leak-when-using-testsolv-to-execute-cases.patch create mode 100644 Fix-segfault-on-conflict-resolution-when-using-bindi.patch diff --git a/Fix-memory-leak-when-using-testsolv-to-execute-cases.patch b/Fix-memory-leak-when-using-testsolv-to-execute-cases.patch new file mode 100644 index 0000000..4750ab6 --- /dev/null +++ b/Fix-memory-leak-when-using-testsolv-to-execute-cases.patch @@ -0,0 +1,29 @@ +From 9a361f5248557e032f15890aac54c0db53c52098 Mon Sep 17 00:00:00 2001 +From: banjiuqingshan <63209634+banjiuqingshan@users.noreply.github.com> +Date: Sun, 19 Jun 2022 01:43:51 +0800 +Subject: [PATCH] Fix memory leak when using testsolv to execute cases + +*resultp will only keep the pointer of the last cycle, which will lead to memory leakage. +This solves the first memory leak problem in issue #496 "==255147==error..." +--- + ext/testcase.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/ext/testcase.c b/ext/testcase.c +index 035cfdbd..c529057a 100644 +--- a/ext/testcase.c ++++ b/ext/testcase.c +@@ -2448,7 +2448,10 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res + } + } + if (resultp) ++ { ++ solv_free(*resultp); + *resultp = result; ++ } + else + solv_free(result); + if (resultflagsp) +-- +2.27.0 + diff --git a/Fix-segfault-on-conflict-resolution-when-using-bindi.patch b/Fix-segfault-on-conflict-resolution-when-using-bindi.patch new file mode 100644 index 0000000..c110735 --- /dev/null +++ b/Fix-segfault-on-conflict-resolution-when-using-bindi.patch @@ -0,0 +1,30 @@ +From 2b5e6c28be7dffe1a3b5e90a35c5ee425c08aeb0 Mon Sep 17 00:00:00 2001 +From: niner +Date: Tue, 8 Feb 2022 18:10:54 +0100 +Subject: [PATCH] Fix segfault on conflict resolution when using bindings + +Solutionelement objects were created with a wrong solutionid (i.e. the +solution element id was used for the solutionid field). This led to invalid +array indexes when trying to read the extraflags which then escalated +into a segfault. Fix by setting solutionid correctly in the Solutionelement +constructor. +--- + bindings/solv.i | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bindings/solv.i b/bindings/solv.i +index 3a6bac46..1d35bf61 100644 +--- a/bindings/solv.i ++++ b/bindings/solv.i +@@ -3411,7 +3411,7 @@ returnself(matchsolvable) + e = solv_calloc(1, sizeof(*e)); + e->solv = solv; + e->problemid = problemid; +- e->solutionid = id; ++ e->solutionid = solutionid; + e->id = id; + e->type = type; + e->p = p; +-- +2.27.0 + diff --git a/libsolv.spec b/libsolv.spec index 7aecdef..98379e7 100644 --- a/libsolv.spec +++ b/libsolv.spec @@ -15,12 +15,15 @@ Name: libsolv Version: 0.7.20 -Release: 1 +Release: 2 Summary: Package dependency solver License: BSD URL: https://github.com/openSUSE/libsolv Source: https://github.com/openSUSE/libsolv/archive/refs/tags/%{version}.tar.gz +Patch0: Fix-segfault-on-conflict-resolution-when-using-bindi.patch +Patch1: Fix-memory-leak-when-using-testsolv-to-execute-cases.patch + BuildRequires: cmake gcc-c++ ninja-build pkgconfig(rpm) zlib-devel BuildRequires: libxml2-devel xz-devel bzip2-devel %if %{with zstd} @@ -213,6 +216,13 @@ Python 3 version. %{_mandir}/man3/%{name}*.3* %changelog +* Tue Oct 11 2022 zhangjun - 0.7.20-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Fix memory leak when using testsolv to execute cases + Fix segfault on conflict resolution when using bindings + * Sat Dec 25 2021 wangkerong - 0.7.20-1 - update to 0.7.20 -- Gitee