[Pkg-gnutls-commits] r1472 - in /packages/p11-kit/trunk/debian: changelog patches/10_broken-hashmap-behavior patches/11_crash-when-duplicate patches/series
ametzler at users.alioth.debian.org
ametzler at users.alioth.debian.org
Sun Apr 15 16:36:10 UTC 2012
Author: ametzler
Date: Sun Apr 15 16:36:09 2012
New Revision: 1472
URL: http://svn.debian.org/wsvn/pkg-gnutls/?sc=1&rev=1472
Log:
Pull two patches from upstream.
+ 10_broken-hashmap-behavior: Fix build-error with squeeze gcc. See also
#651595.
+ 11_crash-when-duplicate: Do not crash on duplicate modules. See
LP#911436, this replaces Ubuntu's duplicate-module-fix.patch.
Added:
packages/p11-kit/trunk/debian/patches/10_broken-hashmap-behavior
packages/p11-kit/trunk/debian/patches/11_crash-when-duplicate
packages/p11-kit/trunk/debian/patches/series
Modified:
packages/p11-kit/trunk/debian/changelog
Modified: packages/p11-kit/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnutls/packages/p11-kit/trunk/debian/changelog?rev=1472&op=diff
==============================================================================
--- packages/p11-kit/trunk/debian/changelog (original)
+++ packages/p11-kit/trunk/debian/changelog Sun Apr 15 16:36:09 2012
@@ -1,6 +1,11 @@
p11-kit (0.12-3) UNRELEASED; urgency=low
* NOT RELEASED YET
+ * Pull two patches from upstream:
+ + 10_broken-hashmap-behavior: Fix build-error with squeeze gcc. See also
+ #651595.
+ + 11_crash-when-duplicate: Do not crash on duplicate modules. See
+ LP#911436, this replaces Ubuntu's duplicate-module-fix.patch.
-- Andreas Metzler <ametzler at debian.org> Wed, 14 Mar 2012 18:27:15 +0100
Added: packages/p11-kit/trunk/debian/patches/10_broken-hashmap-behavior
URL: http://svn.debian.org/wsvn/pkg-gnutls/packages/p11-kit/trunk/debian/patches/10_broken-hashmap-behavior?rev=1472&op=file
==============================================================================
--- packages/p11-kit/trunk/debian/patches/10_broken-hashmap-behavior (added)
+++ packages/p11-kit/trunk/debian/patches/10_broken-hashmap-behavior Sun Apr 15 16:36:09 2012
@@ -1,0 +1,79 @@
+From af8d28014f97ab0d9e4d00961e72aefd7adb470b Mon Sep 17 00:00:00 2001
+From: Stef Walter <stefw at gnome.org>
+Date: Tue, 27 Mar 2012 12:14:56 +0200
+Subject: [PATCH 1/6] Fix broken hashmap behavior
+
+ * We were relying on undefined gcc behavior related to the &
+ operator.
+ * This would show up as a test failure when running with -O2 on
+ certain GCC versions, as well as failure on clang 3.1
+---
+ p11-kit/hashmap.c | 12 +++++-------
+ tests/hash-test.c | 2 --
+ 2 files changed, 5 insertions(+), 9 deletions(-)
+
+diff --git a/p11-kit/hashmap.c b/p11-kit/hashmap.c
+index ceb8a17..1c4aff1 100644
+--- a/p11-kit/hashmap.c
++++ b/p11-kit/hashmap.c
+@@ -64,7 +64,7 @@ next_entry (hashiter *iter)
+ {
+ hashbucket *bucket = iter->next;
+ while (!bucket) {
+- if (iter->index > iter->map->num_buckets)
++ if (iter->index >= iter->map->num_buckets)
+ return NULL;
+ bucket = iter->map->buckets[iter->index++];
+ }
+@@ -109,7 +109,7 @@ lookup_or_create_bucket (hashmap *map,
+ hash = map->hash_func (key);
+
+ /* scan linked list */
+- for (bucketp = &map->buckets[map->num_buckets & hash];
++ for (bucketp = &map->buckets[hash % map->num_buckets];
+ *bucketp != NULL; bucketp = &(*bucketp)->next) {
+ if((*bucketp)->hashed == hash && map->equal_func ((*bucketp)->key, key))
+ break;
+@@ -167,14 +167,13 @@ _p11_hash_set (hashmap *map,
+ /* check that the collision rate isn't too high */
+ if (map->num_items > map->num_buckets) {
+ num_buckets = map->num_buckets * 2 + 1;
+- new_buckets = (hashbucket **)calloc (sizeof (hashbucket *),
+- num_buckets + 1);
++ new_buckets = (hashbucket **)calloc (sizeof (hashbucket *), num_buckets);
+
+ /* Ignore failures, maybe we can expand later */
+ if(new_buckets) {
+ _p11_hash_iterate (map, &iter);
+ while ((bucket = next_entry (&iter)) != NULL) {
+- unsigned int i = bucket->hashed & num_buckets;
++ unsigned int i = bucket->hashed % num_buckets;
+ bucket->next = new_buckets[i];
+ new_buckets[i] = bucket;
+ }
+@@ -276,8 +275,7 @@ _p11_hash_create (hash_hash_func hash_func,
+ map->value_destroy_func = value_destroy_func;
+
+ map->num_buckets = 9;
+- map->buckets = (hashbucket **)calloc (sizeof (hashbucket *),
+- map->num_buckets + 1);
++ map->buckets = (hashbucket **)calloc (sizeof (hashbucket *), map->num_buckets);
+ if (!map->buckets) {
+ free (map);
+ return NULL;
+diff --git a/tests/hash-test.c b/tests/hash-test.c
+index 876088b..530c67c 100644
+--- a/tests/hash-test.c
++++ b/tests/hash-test.c
+@@ -171,8 +171,6 @@ test_set_clear (CuTest *tc)
+
+ map = _p11_hash_create (_p11_hash_direct_hash, _p11_hash_direct_equal, NULL, NULL);
+
+- fprintf (stderr, "%p setting\n", value);
+-
+ if (!_p11_hash_set (map, key, value))
+ CuFail (tc, "should not be reached");
+
+--
+1.7.9.5
+
Added: packages/p11-kit/trunk/debian/patches/11_crash-when-duplicate
URL: http://svn.debian.org/wsvn/pkg-gnutls/packages/p11-kit/trunk/debian/patches/11_crash-when-duplicate?rev=1472&op=file
==============================================================================
--- packages/p11-kit/trunk/debian/patches/11_crash-when-duplicate (added)
+++ packages/p11-kit/trunk/debian/patches/11_crash-when-duplicate Sun Apr 15 16:36:09 2012
@@ -1,0 +1,43 @@
+From ff9926b8dcead91e7fc6d08d0ca1d2d8cc982308 Mon Sep 17 00:00:00 2001
+From: Stef Walter <stefw at gnome.org>
+Date: Sun, 1 Apr 2012 21:56:35 +0200
+Subject: [PATCH 3/6] Fix crasher when a duplicate module is present
+
+---
+ p11-kit/modules.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/p11-kit/modules.c b/p11-kit/modules.c
+index f059097..569a735 100644
+--- a/p11-kit/modules.c
++++ b/p11-kit/modules.c
+@@ -440,6 +440,13 @@ take_config_and_load_module_unlocked (char **name, hashmap **config)
+ return rv;
+ }
+
++ /*
++ * We support setting of CK_C_INITIALIZE_ARGS.pReserved from
++ * 'x-init-reserved' setting in the config. This only works with specific
++ * PKCS#11 modules, and is non-standard use of that field.
++ */
++ mod->init_args.pReserved = _p11_hash_get (mod->config, "x-init-reserved");
++
+ prev = _p11_hash_get (gl.modules, mod->funcs);
+
+ /* If same module was loaded previously, just take over config */
+@@ -463,12 +470,6 @@ take_config_and_load_module_unlocked (char **name, hashmap **config)
+ }
+
+ }
+- /*
+- * We support setting of CK_C_INITIALIZE_ARGS.pReserved from
+- * 'x-init-reserved' setting in the config. This only works with specific
+- * PKCS#11 modules, and is non-standard use of that field.
+- */
+- mod->init_args.pReserved = _p11_hash_get (mod->config, "x-init-reserved");
+
+ return CKR_OK;
+ }
+--
+1.7.9.5
+
Added: packages/p11-kit/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnutls/packages/p11-kit/trunk/debian/patches/series?rev=1472&op=file
==============================================================================
--- packages/p11-kit/trunk/debian/patches/series (added)
+++ packages/p11-kit/trunk/debian/patches/series Sun Apr 15 16:36:09 2012
@@ -1,0 +1,2 @@
+10_broken-hashmap-behavior
+11_crash-when-duplicate
More information about the Pkg-gnutls-commits
mailing list