File: mayhem.patch

package info (click to toggle)
ampliconnoise 1.29-16
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,316 kB
  • sloc: ansic: 18,085; sh: 2,901; perl: 2,089; makefile: 240
file content (74 lines) | stat: -rw-r--r-- 2,399 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Author: Andreas Tille <tille@debian.org>
Last-Update: 2015-12-18
Bug-Debian: https://bugs.debian.org/715593
            https://bugs.debian.org/715594
Description: Fix Mayhem issues by making reading fasta files more robust
 The package is orphaned upstream, hence not forwarded.
Forwarded: no

--- a/Perseus/Perseus.c
+++ b/Perseus/Perseus.c
@@ -839,6 +839,11 @@ void readData(char* szInputFile, t_Data
 	}
 
 	szBrk = strpbrk(szLine, " \n");
+        if(! szBrk)
+        {
+            fprintf(stderr, "File %s does not appear to be in FASTA format.\n", szInputFile);
+            exit(EXIT_FAILURE);
+        }
 	(*szBrk) = '\0';
 	ptData->aszID[nSequences] = strdup(szLine + 1);
 	ptData->adFreq[nSequences] = getWeight(ptData->aszID[nSequences]);
--- a/PerseusD/PerseusD.c
+++ b/PerseusD/PerseusD.c
@@ -891,6 +891,11 @@ void readData(char* szInputFile, t_Data
 	}
 
 	szBrk = strpbrk(szLine, " \n");
+        if(! szBrk)
+        {
+            fprintf(stderr, "File %s does not appear to be in FASTA format.\n", szInputFile);
+            exit(EXIT_FAILURE);
+        }
 	(*szBrk) = '\0';
 	ptData->aszID[nSequences] = strdup(szLine + 1);
 	ptData->anFreq[nSequences] = getWeight(ptData->aszID[nSequences]);
--- a/SeqNoise/SeqNoise.c
+++ b/SeqNoise/SeqNoise.c
@@ -634,6 +634,11 @@ void readData(t_Data *ptData, t_Params *
 	}
 
 	szBrk = strpbrk(szLine, " \n");
+        if(! szBrk)
+        {
+            fprintf(stderr, "File %s does not appear to be in FASTA format.\n", ptParams->szDataFile);
+            exit(EXIT_FAILURE);
+        }
 	(*szBrk) = '\0';
 	ptData->aszID[nSequences] = strdup(szLine + 1);
 	ptData->adW[nSequences]   = getWeight(ptData->aszID[nSequences]);
@@ -2454,6 +2459,11 @@ void readDistanceMatrix(char *szDistFile
     
     szBrk = strpbrk(szLine, "\n");
 
+    if(! szBrk)
+    {
+        fprintf(stderr, "File %s does not appear to be in FASTA format.\n", szDistFile);
+        exit(EXIT_FAILURE);
+    }
     (*szBrk) = '\0';
 
     nTest = strtol(szLine, &pcError, 10);
@@ -2478,6 +2488,11 @@ void readDistanceMatrix(char *szDistFile
 	fgets(szLine, MAX_LINE_LENGTH, ifp);
     
 	szBrk = strpbrk(szLine, "\n");
+        if(! szBrk)
+        {
+            fprintf(stderr, "File %s does not appear to be in FASTA format.\n", szDistFile);
+            exit(EXIT_FAILURE);
+        }
 	(*szBrk) = '\0';
 
 	afDist[i*nN + j] = (float) strtod(szLine, &pcError);