bugfix: bwa-sw PE segfault in rare case

This commit is contained in:
Heng Li 2011-11-28 09:12:21 -05:00
parent bf65b6463a
commit 64e353ce49
3 changed files with 37 additions and 3 deletions

33
NEWS
View File

@ -1,3 +1,36 @@
Release 0.6.1 (25 November, 2011)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Notable changes to BWA-short:
* Bugfix: duplicated alternative hits in the XA tag.
* Bugfix: when trimming enabled, bwa-aln trims 1bp less.
* Disabled the color-space alignment. 0.6.x is not working with SOLiD reads at
present.
Notable changes to BWA-SW:
* Bugfix: segfault due to excessive ambiguous bases.
* Bugfix: incorrect mate position in the SE mode.
* When macro _NO_SSE2 is in use, fall back to the standard Smith-Waterman
instead of SSE2-SW.
* Optionally mark split hits with lower alignment scores as secondary.
Changes to fastmap:
* Bugfix: infinite loop caused by ambiguous bases.
* Optionally output the query sequence.
(0.6.1: 25 November 2011, r103)
Release 0.5.10 and 0.6.0 (12 November, 2011)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -437,7 +437,7 @@ bwa_cigar_t *bwa_sw_core(bwtint_t l_pac, const ubyte_t *pacseq, int len, const u
bwa_cigar_t *cigar = 0;
ubyte_t *ref_seq;
bwtint_t k, x, y, l;
int path_len, ret;
int path_len, ret, subo;
AlnParam ap = aln_param_bwa;
path_t *path, *p;
@ -454,8 +454,8 @@ bwa_cigar_t *bwa_sw_core(bwtint_t l_pac, const ubyte_t *pacseq, int len, const u
path = (path_t*)calloc(l+len, sizeof(path_t));
// do alignment
ret = aln_local_core(ref_seq, l, (ubyte_t*)seq, len, &ap, path, &path_len, 1, 0);
if (ret < 0) {
ret = aln_local_core(ref_seq, l, (ubyte_t*)seq, len, &ap, path, &path_len, 1, &subo);
if (ret < 0 || subo == ret) { // no hit or tandem hits
free(path); free(cigar); free(ref_seq); *n_cigar = 0;
return 0;
}

View File

@ -111,6 +111,7 @@ void bsw2_pair1(const bsw2opt_t *opt, int64_t l_pac, const uint8_t *pac, const b
}
if (beg < 1) beg = 1;
if (end > l_pac) end = l_pac;
if (end - beg < l_mseq) return;
// generate the sequence
seq = malloc(l_mseq + (end - beg));
ref = seq + l_mseq;