[med-svn] [libdisorder] 01/01: Handle large inputs correctly.

Guus Sliepen guus at moszumanska.debian.org
Mon Jun 27 22:07:37 UTC 2016


This is an automated email from the git hooks/post-receive script.

guus pushed a commit to branch master
in repository libdisorder.

commit 4bf37f59386b5f829761908a25e54239c12c5a02
Author: Guus Sliepen <guus at debian.org>
Date:   Tue Jun 28 00:05:18 2016 +0200

    Handle large inputs correctly.
    
    The main library function takes the size of the input as a long long, so
    one might expect it to work on inputs up to 2^63-1 in length. However,
    it then incorrectly used ints for the histogram and iterators.
---
 debian/patches/handle-large-inputs-correctly.patch | 29 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 30 insertions(+)

diff --git a/debian/patches/handle-large-inputs-correctly.patch b/debian/patches/handle-large-inputs-correctly.patch
new file mode 100644
index 0000000..9914de6
--- /dev/null
+++ b/debian/patches/handle-large-inputs-correctly.patch
@@ -0,0 +1,29 @@
+--- a/src/disorder.c
++++ b/src/disorder.c
+@@ -30,7 +30,7 @@
+ #endif
+ 
+ /** Frequecies for each byte */
+-static __thread int m_token_freqs[LIBDO_MAX_BYTES]; //frequency of each token in sample
++static __thread long long m_token_freqs[LIBDO_MAX_BYTES]; //frequency of each token in sample
+ static __thread float m_token_probs[LIBDO_MAX_BYTES]; //P(each token appearing)
+ static __thread int m_num_tokens = 0; //actual number of `seen' tokens, max 256
+ static __thread float m_maxent = 0.0;
+@@ -85,7 +85,7 @@
+ get_token_frequencies(char* buf, 
+ 		      long long length)
+ {
+-  int i=0;
++  long long i=0;
+   char* itr=NULL;
+   unsigned char c=0;
+ 
+@@ -129,7 +129,7 @@
+   float bits = 0.0;
+   char* itr=NULL; //values of itr should be zero to 255
+   unsigned char token;
+-  int num_events = 0; //`length' parameter
++  long long num_events = 0; //`length' parameter
+   float freq = 0.0; //loop variable for holding freq from m_token_freq[]
+   float entropy = 0.0; //running entropy sum
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 36825b1..7da5fd6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 thread-safety.patch
 cpp.patch
 autoconf.patch
+handle-large-inputs-correctly.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/libdisorder.git



More information about the debian-med-commit mailing list