Grow memory if applying a query after increasing a number of available packages

Resolves: RHEL-27657
This commit is contained in:
Petr Písař 2024-04-16 17:08:30 +02:00
parent 1356201902
commit dec77ba440
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 3c5641a9c7c416e387a54eaf7dad7c33db52b0ec Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Wed, 6 Mar 2024 07:46:34 +0100
Subject: [PATCH] Replace assert by map_grow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream commit: ef8ac7fcedea1ec87dd3149ce1abdf8daeee25b9
It will make code prepared for situation when number of solvables
is increased after query is created and applied.
The issue can be easilly triggered by adding remote RPMs therefore
the patch fixes a standard situation
Resolves: https://issues.redhat.com/browse/RHEL-27657
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
libdnf/sack/query.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdnf/sack/query.cpp b/libdnf/sack/query.cpp
index 79377703..6eecfa50 100644
--- a/libdnf/sack/query.cpp
+++ b/libdnf/sack/query.cpp
@@ -2313,7 +2313,7 @@ Query::Impl::apply()
if (!result)
initResult();
map_init(&m, pool->nsolvables);
- assert(m.size == result->getMap()->size);
+ map_grow(result->getMap(), pool->nsolvables);
for (auto f : filters) {
map_empty(&m);
switch (f.getKeyname()) {
--
2.44.0

View File

@ -58,7 +58,7 @@
Name: libdnf Name: libdnf
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version} Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
Release: 8%{?dist} Release: 9%{?dist}
Summary: Library providing simplified C and Python API to libsolv Summary: Library providing simplified C and Python API to libsolv
License: LGPLv2+ License: LGPLv2+
URL: https://github.com/rpm-software-management/libdnf URL: https://github.com/rpm-software-management/libdnf
@ -71,6 +71,7 @@ Patch5: 0005-filterAdvisory-installed_solvables-sort-RhBug2212838.patch
Patch6: 0006-hawkeysubject-get_best_selectors-only-obsol-oflatest.patch Patch6: 0006-hawkeysubject-get_best_selectors-only-obsol-oflatest.patch
Patch7: 0007-Avoid-reinstal-installonly-packages-marked-for-ERASE.patch Patch7: 0007-Avoid-reinstal-installonly-packages-marked-for-ERASE.patch
Patch8: 0008-PGP-Set-a-default-creation-SELinux-labels-on-GnuPG-d.patch Patch8: 0008-PGP-Set-a-default-creation-SELinux-labels-on-GnuPG-d.patch
Patch9: 0009-Replace-assert-by-map_grow.patch
BuildRequires: cmake BuildRequires: cmake
@ -320,6 +321,10 @@ popd
%endif %endif
%changelog %changelog
* Tue Apr 16 2024 Petr Pisar <ppisar@redhat.com> - 0.69.0-9
- Grow memory if applying a query after increasing a number of available
packages (RHEL-27657)
* Wed Oct 25 2023 Petr Pisar <ppisar@redhat.com> - 0.69.0-8 * Wed Oct 25 2023 Petr Pisar <ppisar@redhat.com> - 0.69.0-8
- Set default SELinux labels on GnuPG directories (RHEL-11238) - Set default SELinux labels on GnuPG directories (RHEL-11238)