[DRE-commits] [ruby-bdb] 03/09: Add 'fix-integer-overflow-on-bdb_h_hash-callback' patch
David Suárez
deiv-guest at moszumanska.debian.org
Sat May 3 12:05:16 UTC 2014
This is an automated email from the git hooks/post-receive script.
deiv-guest pushed a commit to branch master
in repository ruby-bdb.
commit b9fae60c4d114597b44fa123157e42bd2b0dc604
Author: David Suárez <david.sephirot at gmail.com>
Date: Fri May 2 22:18:35 2014 +0200
Add 'fix-integer-overflow-on-bdb_h_hash-callback' patch
---
...x-integer-overflow-on-bdb_h_hash-callback.patch | 42 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 43 insertions(+)
diff --git a/debian/patches/fix-integer-overflow-on-bdb_h_hash-callback.patch b/debian/patches/fix-integer-overflow-on-bdb_h_hash-callback.patch
new file mode 100644
index 0000000..071fa2b
--- /dev/null
+++ b/debian/patches/fix-integer-overflow-on-bdb_h_hash-callback.patch
@@ -0,0 +1,42 @@
+Description: Fix integer overflow on bdb_h_hash function
+ Simply truncate the results and add a comment about this fact on the docs
+
+Author: David Suárez <david.sephirot at gmail.com>
+Last-Update: 2014-05-02
+
+--- a/src/common.c
++++ b/src/common.c
+@@ -524,7 +524,10 @@ bdb_h_hash(DB *dbbd, const void *bytes,
+ res = rb_funcall(obj, id_h_hash, 1, st);
+ else
+ res = rb_funcall(dbst->h_hash, bdb_id_call, 1, st);
+- return NUM2UINT(res);
++
++ unsigned long r = NUM2ULONG(res);
++
++ return r;
+ }
+
+ #if HAVE_ST_DB_SET_H_COMPARE
+--- a/docs/common.rb
++++ b/docs/common.rb
+@@ -74,7 +74,7 @@ class BDB::Common
+ # * <em>set_fetch_value</em> : specify a Proc called after a value is read
+ # * <em>set_flags</em> : general database configuration
+ # * <em>set_h_ffactor</em> : set the Hash table density
+- # * <em>set_h_hash</em> : specify a hashing function
++ # * <em>set_h_hash</em> : specify a hashing function (due to bdb internals, the result will be truncated at 32 bits)
+ # * <em>set_h_nelem</em> : set the Hash table size
+ # * <em>set_lorder</em> : set the database byte order
+ # * <em>set_pagesize</em> : set the underlying database page size
+--- a/docs/hashlike.rd
++++ b/docs/hashlike.rd
+@@ -183,7 +183,7 @@ These are the common methods for ((|BDB:
+ : ((|set_fetch_value|)) : specify a Proc called after a value is read
+ : ((|set_flags|)) : general database configuration
+ : ((|set_h_ffactor|)) : set the Hash table density
+- : ((|set_h_hash|)) : specify a hashing function
++ : ((|set_h_hash|)) : specify a hashing function (due to bdb internals, the result will be truncated at 32 bits)
+ : ((|set_h_nelem|)) : set the Hash table size
+ : ((|set_lorder|)) : set the database byte order
+ : ((|set_pagesize|)) : set the underlying database page size
diff --git a/debian/patches/series b/debian/patches/series
index db8a844..72f2d1f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@ remove-src-dir-from-tests-load-path.patch
dont-rely-on-ruby-objects-to-accommodate-c-data.patch
use-same-encoding-for-dup-test.patch
update-bdb-versions.patch
+fix-integer-overflow-on-bdb_h_hash-callback.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-bdb.git
More information about the Pkg-ruby-extras-commits
mailing list