Skip to content

bug in parsing GI from the VERSION line #6

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. running on a flat file such as the nc1213.flat from a daily incremental 
update file
2. printing out the sGI field.


What is the expected output? What do you see instead?
The GI of each field should be printed. Instead you get "ION     D" (for me, I 
think that it is reading from the wrong part of memory, so this is probably not 
reproducible.

What version of the product are you using? On what operating system?
0.6.1   on ubuntu 14.04

Please provide any additional information below.
The patch that fixes it for me is:

########################################
--- a/gbfp.c
+++ b/gbfp.c
@@ -227,16 +227,21 @@ static void parseAccession(FILE *FSeqFile, gb_data 
*ptGBData) {
 }

 static void parseVersion(FILE *FSeqFile, gb_data *ptGBData) {
+    char prev;
+    int offset;
     char sLine[LINELEN];
     regmatch_t ptRegMatch[2];

     getLine_w_rtrim(sLine, FSeqFile);

     if (regexec(&ptRegExVersion, sLine, 2, ptRegMatch, 0) == 0) {
-        *(sLine + ptRegMatch[1].rm_eo) = '\0';
+        offset = ptRegMatch[1].rm_eo;
+        prev = sLine[offset];
+        sLine[offset] = '\0';
         ptGBData->sVersion = strdup(sLine + ptRegMatch[1].rm_so);
+        sLine[offset] = prev;
     }
-    if (regexec(&ptRegExGI, sLine + ptRegMatch[1].rm_eo + 1, 2, ptRegMatch, 0) 
== 0) {
+    if (regexec(&ptRegExGI, sLine, 2, ptRegMatch, 0) == 0) {
         *(sLine + ptRegMatch[1].rm_eo) = '\0';
         ptGBData->sGI = strdup(sLine + ptRegMatch[1].rm_so);
     }



Original issue reported on code.google.com by mthol...@gmail.com on 14 Jan 2015 at 2:56

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions