]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix logic error in allochashtable
authorMichael Schroeder <mls@suse.de>
Fri, 15 May 2026 08:50:22 +0000 (10:50 +0200)
committerMichael Schroeder <mls@suse.de>
Fri, 15 May 2026 08:50:22 +0000 (10:50 +0200)
src/hash.h
src/repo.c

index 365d0d6363666f438643b82b88059ff534a96f1f..18b7c2d859bdf164bd57d74d2570a150b371c299 100644 (file)
@@ -92,7 +92,7 @@ mkmask(unsigned int num)
 static inline Hashtable
 allochashtable(Hashval mask, size_t size)
 {
-  if (mask == 0 && ((size_t)mask + 1) == 0)
+  if (mask == 0 || ((size_t)mask + 1) == 0)
     solv_oom((size_t)mask, size * sizeof(Id));
   return (Hashtable)solv_calloc((size_t)mask + 1, size * sizeof(Id));
 }
index 625eb2f1c0109ad8d904c0d09d8e2f764f6b9775..e0705d3f0c86e0380497bc462aa7de98ef661fbc 100644 (file)
@@ -396,7 +396,7 @@ repo_addid_dep_hash(Repo *repo, Offset olddeps, Id id, Id marker, int size)
   if (repo->lastidhash_idarraysize != repo->idarraysize || (Hashval)size * 2 > repo->lastidhash_mask || repo->lastmarker != marker)
     {
       repo->lastmarkerpos = 0;
-      if ((Hashval)size * 2 > repo->lastidhash_mask)
+      if ((Hashval)size * 2 >= repo->lastidhash_mask)
        {
          repo->lastidhash_mask = mkmask(size < REPO_ADDID_DEP_HASHMIN ? REPO_ADDID_DEP_HASHMIN : size);
          solv_free(repo->lastidhash);