[med-svn] [roadtrips] 01/01: Since roadtrips is violating array boundaries I add a small patch that helps debugging the issue

Andreas Tille tille at debian.org
Tue Nov 24 17:24:40 UTC 2015


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

tille pushed a commit to branch master
in repository roadtrips.

commit 4d077473d465b01b285eb3bd0305a8f24ab9952f
Author: Andreas Tille <tille at debian.org>
Date:   Tue Nov 24 18:23:57 2015 +0100

    Since roadtrips is violating array boundaries I add a small patch that helps debugging the issue
---
 debian/patches/debug1.patch | 67 +++++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series       |  1 +
 2 files changed, 68 insertions(+)

diff --git a/debian/patches/debug1.patch b/debian/patches/debug1.patch
new file mode 100644
index 0000000..15dce52
--- /dev/null
+++ b/debian/patches/debug1.patch
@@ -0,0 +1,67 @@
+Description: Try to avoid crash that will probably be caused by violating
+ array boundaries
+ .
+ The executable fails when calling and the DEBUG statements are marking
+ the point where this crash happens.
+ .
+ The attempt to fix the crash in the first hunk of the patch by simply
+ increasing the array boundaries failed and I have given up at this point.
+Author: Andreas Tille <tille at debian.org>
+
+--- a/ROADTRIPS_SOURCE.c
++++ b/ROADTRIPS_SOURCE.c
+@@ -898,7 +898,10 @@ ROBUSTVAR=dvector(1,M);
+ 		famdata[fam].chol=dmatrix(1,Mark[m].typed[fam].N,1,Mark[m].typed[fam].N);
+ 
+ 
+-		cholaug=dmatrix(1,Mark[m].typed[fam].N,1,M+3+Mark[m].typed[fam].N);
++printf ("DEBUG %i: fam=%i, Mark[m].typed[fam].N=%i, M=%i, M+3+Mark[m].typed[fam].N=%i\n" , __LINE__, fam, Mark[m].typed[fam].N, M, M+3+Mark[m].typed[fam].N);
++/*  Avoid overriding array boundaries by simply increasing the array size                        *
++ * it would be better to change the code accordingly by starting with array index 0 in all loops */
++		cholaug=dmatrix(1,Mark[m].typed[fam].N+1,1,M+3+Mark[m].typed[fam].N+1);
+ 
+ kincoefMatrix=dmatrix(1,Mark[m].typed[fam].N,1,Mark[m].typed[fam].N); 
+ 	    
+@@ -928,10 +931,9 @@ kincoefMatrix=dmatrix(1,Mark[m].typed[fa
+ 
+ 
+ 
+-
+-
++printf ("DEBUG %i: fam=%i, m=%i\n" , __LINE__, fam, m);
+  readGenotypes(fam,m,famdata[fam].Pheno,famdata[fam].cholent,cholentCase,cholentControl,cholentUnknown,famdata[fam].MissingVec,famdata[fam].Pheno-Mark[m].typed[fam].N,kincoefMatrix,kincoefMatrixCase,kincoefMatrixControl,kincoefMatrixUnknown);
+-
++printf ("DEBUG %i: fam=%i, m=%i\n" , __LINE__, fam, m);
+ 
+  	      
+     
+@@ -3576,16 +3578,25 @@ cholaug[tot][M+2]=2*famdata[fam].MZ[i][2
+  tot=tot--;
+  /*printf("tot is %d and about to get matrix now\n",tot); */
+ 
++/* Addressing arrays starting with 1 is simply wrong and leads to overriding *
++ * array boundaries at the marked position                                   */
+ for(i=1;i<=tot;i++)
+-  {for(j=1;j<=tot;j++)
++  {
++  for(j=1;j<=tot;j++)
+       {if(i==j)
+-       {cholaug[i][M+3+j]=1;}
++       {
++   cholaug[i][M+3+j]=1;
++ }
+ else
+-{cholaug[i][M+3+j]=0;}
++{
++printf ("DEBUG %i: !!! i!=j!! i=%i, M+3+j=%i, M=%i, j=%i\n" , __LINE__, i, M+3+j, M, j);
++/* Here the boundaries would be overridden for i=17 */
++cholaug[i][M+3+j]=0;
++printf ("DEBUG %i: i=%i, tot=%i\n" , __LINE__, i, tot);
++}
+    }
+   }
+ 
+- 
+ /*for(i=1;i<=tot;i++)
+   {for(j=1;j<=(M+3+tot);j++)
+       {printf("%lf ",cholaug[i][j]);}
diff --git a/debian/patches/series b/debian/patches/series
index b03df3b..5a80601 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 debian_file_locations.patch
 hardening.patch
+debug1.patch

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



More information about the debian-med-commit mailing list