diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-06 14:13:38 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-06 14:13:38 +0000 |
commit | 8852f5f8ff3d521897175ddeb711d6b77e03fa8a (patch) | |
tree | 3b8d72cbf4bfb5c2aef091e111aecff61063f5f6 /src/util/container_bloomfilter.c | |
parent | e22f7eb50d960e9b67cbf782afb9fb833362072c (diff) | |
download | gnunet-8852f5f8ff3d521897175ddeb711d6b77e03fa8a.tar.gz gnunet-8852f5f8ff3d521897175ddeb711d6b77e03fa8a.zip |
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
Diffstat (limited to 'src/util/container_bloomfilter.c')
-rw-r--r-- | src/util/container_bloomfilter.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index 180aab4c3..31e777dc3 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c | |||
@@ -463,7 +463,8 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size, | |||
463 | if (size < BUFFSIZE) | 463 | if (size < BUFFSIZE) |
464 | size = BUFFSIZE; | 464 | size = BUFFSIZE; |
465 | ui = 1; | 465 | ui = 1; |
466 | while (ui < size) | 466 | while ( (ui < size) && |
467 | (ui * 2 > ui) ) | ||
467 | ui *= 2; | 468 | ui *= 2; |
468 | size = ui; /* make sure it's a power of 2 */ | 469 | size = ui; /* make sure it's a power of 2 */ |
469 | 470 | ||