baoe / AlignGraph

Algorithm for secondary de novo genome assembly guided by closely related references
166 stars 23 forks source link

SegFault -- out of bounds array index #3

Open kmhernan opened 10 years ago

kmhernan commented 10 years ago

I posted this on a previously closed ticket, but I'm not sure if you get updates on such responses, so I'm opening a new ticket here. I am having a SegFault issue similar to one reported on a closed ticket. I have tried to narrow down where this happens and provide that information here:

Here is a snippet of your code mixed with my prints (starting around line 1275):

cont:
    cout << "cont: A" << endl;
    k2.traversed = 0;
    k2.s = nextS;
    k2.chromosomeID0 = nextID0;
    k2.chromosomeOffset0 = nextOffset0;
    k2.coverage = 0;
    k2.A = k2.C = k2.G = k2.T = k2.N = 0;

    cout << "cont: B" << endl;
    cout << "nextid: " << nextID << ", nextOffset: " << nextOffset << endl;
    cout << genome[nextID][nextOffset].contiMer.size() << endl;
    cout << "nextid0: " << nextID0 << ", nextOffset0: " << nextOffset0 << endl;
    cout << genome[nextID0][nextOffset0].contiMer.size() << endl;

I have additional cout statements at the beginning of each if() statement and just before each if() statements; however the last few lines of the std out are:

cont: A
cont: B
nextid: 0, nextOffset: 28150056
0
nextid0: 4294967295, nextOffset0: 4294967295

So, it appears that for some reason the segfault is caused by trying to lookup indices that don't exist (genome[nextID0][nextOffset0]). Any thoughts?

baoe commented 9 years ago

Hi, Kyle,

I'm sorry for this late reply. I was busy several days ago and simply missed this post...

Anyways, for your question, I don't think the crash is caused by the "unsigned values for nextid0 and nextoffset0". Actually, both nextid0 and nextoffset0 have values -1 (which is equal to 4294967295 printed as an unsigned number). Whether or not nextID0 == -1 is judged and if it is true, going to genome[nextID0][nextOffset0] is avoided (the statement A||B will not go into B if A is true).

It will be hard for me to debug without the input files causing the bug, so I'm sorry I may not help but hopefully the problem can be resolved in the following updates.

Best, Bao


From: Kyle Hernandez [notifications@github.com] Sent: Thursday, October 16, 2014 8:16 AM To: baoe/AlignGraph Subject: [AlignGraph] SegFault -- out of bounds array index (#3)

I posted this on a previously closed ticket, but I'm not sure if you get updates on such responses, so I'm opening a new ticket here. I am having a SegFault issue similar to one reported on a closed ticket. I have tried to narrow down where this happens and provide that information here:

Here is a snippet of your code mixed with my prints (starting around line 1275):

cont: cout << "cont: A" << endl; k2.traversed = 0; k2.s = nextS; k2.chromosomeID0 = nextID0; k2.chromosomeOffset0 = nextOffset0; k2.coverage = 0; k2.A = k2.C = k2.G = k2.T = k2.N = 0;

cout << "cont: B" << endl;
cout << "nextid: " << nextID << ", nextOffset: " << nextOffset << endl;
cout << genome[nextID][nextOffset].contiMer.size() << endl;
cout << "nextid0: " << nextID0 << ", nextOffset0: " << nextOffset0 << endl;
cout << genome[nextID0][nextOffset0].contiMer.size() << endl;

I have additional cout statements at the beginning of each if() statement and just before each if() statements; however the last few lines of the std out are:

cont: A cont: B nextid: 0, nextOffset: 28150056 0 nextid0: 4294967295, nextOffset0: 4294967295

So, it appears that for some reason the segfault is caused by trying to lookup indices that don't exist (genome[nextID0][nextOffset0]). Any thoughts?

— Reply to this email directly or view it on GitHubhttps://github.com/baoe/AlignGraph/issues/3.