[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18460 - in gnunet/src: datastore util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18460 - in gnunet/src: datastore util |
Date: |
Tue, 6 Dec 2011 15:13:38 +0100 |
Author: grothoff
Date: 2011-12-06 15:13:38 +0100 (Tue, 06 Dec 2011)
New Revision: 18460
Modified:
gnunet/src/datastore/gnunet-service-datastore.c
gnunet/src/util/common_allocation.c
gnunet/src/util/container_bloomfilter.c
Log:
Fixing #1976 by allowing allocations between INT_MAX and SIZE_MAX and at the
same time limiting BF size for datastore to 2 GB. Also fixing infinite loop
when creating BFs of sizes between 2-4 GB
Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c 2011-12-06 13:56:42 UTC
(rev 18459)
+++ gnunet/src/datastore/gnunet-service-datastore.c 2011-12-06 14:13:38 UTC
(rev 18460)
@@ -1492,7 +1492,10 @@
cache_size = quota / 8; /* Or should we make this an option? */
GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size,
GNUNET_NO);
- bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */
+ if (quota / 32LL > (1 << 31))
+ bf_size = (1 << 31); /* absolute limit: ~2 GB, beyond that BF
just won't help anyway */
+ else
+ bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */
fn = NULL;
if ((GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg, "DATASTORE",
"BLOOMFILTER",
Modified: gnunet/src/util/common_allocation.c
===================================================================
--- gnunet/src/util/common_allocation.c 2011-12-06 13:56:42 UTC (rev 18459)
+++ gnunet/src/util/common_allocation.c 2011-12-06 14:13:38 UTC (rev 18460)
@@ -136,7 +136,6 @@
return NULL;
#endif
- GNUNET_assert_at (size < INT_MAX, filename, linenumber);
result = malloc (size);
if (result == NULL)
return NULL;
Modified: gnunet/src/util/container_bloomfilter.c
===================================================================
--- gnunet/src/util/container_bloomfilter.c 2011-12-06 13:56:42 UTC (rev
18459)
+++ gnunet/src/util/container_bloomfilter.c 2011-12-06 14:13:38 UTC (rev
18460)
@@ -463,7 +463,8 @@
if (size < BUFFSIZE)
size = BUFFSIZE;
ui = 1;
- while (ui < size)
+ while ( (ui < size) &&
+ (ui * 2 > ui) )
ui *= 2;
size = ui; /* make sure it's a power of 2 */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18460 - in gnunet/src: datastore util,
gnunet <=