]> mj.ucw.cz Git - libucw.git/commitdiff
sorter: fixed buffer allocation in s-internal, the workspace was too small
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Thu, 27 Sep 2007 04:43:33 +0000 (06:43 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Thu, 27 Sep 2007 04:43:33 +0000 (06:43 +0200)
lib/sorter/s-internal.h

index 35ba1f50dde6ab00ddb1c98495f5900c5ebf542f..0c39613d45c8642c8fd1186dd5da69ad795b31f3 100644 (file)
@@ -137,7 +137,7 @@ static int P(internal)(struct sort_context *ctx, struct sort_bucket *bin, struct
 #endif
       uns dsize = SORT_DATA_SIZE(key);
       uns recsize = ALIGN_TO(ksize_aligned + dsize, CPU_STRUCT_ALIGN);
-      size_t totalsize = recsize + sizeof(P(internal_item_t) *) + P(internal_workspace)(&key);
+      size_t totalsize = recsize + 2 * P(internal_workspace)(&key);
       if (unlikely(totalsize > remains
 #ifdef CPU_64BIT_POINTERS
                   || item >= item_array + ~0U          // The number of items must fit in an uns