[Bio-bwa-help] [lh3@sanger.ac.uk: Re: BWA 0.5.7 seqfault fixed]
Status: Beta
Brought to you by:
lh3lh3
From: Heng Li <lh...@sa...> - 2010-04-16 13:18:28
|
----- Forwarded message from Heng Li <lh...@sa...> ----- Date: Fri, 16 Apr 2010 09:17:53 -0400 From: Heng Li <lh...@sa...> To: Vaughn Iverson <vsi@u.washington.edu> Cc: Chris Berthiaume <chrisbee@u.washington.edu> Subject: Re: BWA 0.5.7 seqfault fixed User-Agent: Mutt/1.5.20 (2009-06-14) Many thanks for the fix. This is indeed a bug. Best, Heng On Thu, Apr 15, 2010 at 04:42:28PM -0700, Vaughn Iverson wrote: > Hi Heng, Just wanted to let you know that I found and fixed a > seqfault in BWA 0.5.7 > > The problem is a simple bug in the new code to handle outputting > multiple matches for a read in the new SAM format. > > In bwase.c line: 59 > > Change: > > s->multi = calloc(rest, rest * sizeof(bwt_multi1_t)); > > to: > > s->multi = calloc(rest, sizeof(bwt_multi1_t)); > > As I'm sure you know, calloc automatically multiples the first > (count) parameter with the second (size) parameter to get the bytes > of memory allocated. > The line with the bug effectively requests the square of the actual > number of structures needed, with will quickly exhaust the memory of > any machine when the number of matches gets large. > > This calloc will fail in those cases, btu there is no code to check > that it succeeds, resulting in a NULL pointer exception when that > case arises. This bug could also cause other undesirable effects > such as hitting the ULIMIT for a job on a cluster node > unnecessarily, causing a job to be killed by the kernal, even when > the physical memory is available, etc. > > We will be patching our own private version of BWA, but I wanted you > to have this for the next release. > > Cheers, -Vaughn > > ----- End forwarded message ----- -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE. |