r741: fixed segfault in rare cases

This commit is contained in:
Heng Li 2014-05-01 11:13:05 -04:00
parent 4b2441069f
commit 7954e77a1b
2 changed files with 7 additions and 5 deletions

10
bwa.c
View File

@ -107,10 +107,12 @@ uint32_t *bwa_gen_cigar2(const int8_t mat[25], int o_del, int e_del, int o_ins,
tmp = rseq[i], rseq[i] = rseq[rlen - 1 - i], rseq[rlen - 1 - i] = tmp;
}
if (l_query == re - rb && w_ == 0) { // no gap; no need to do DP
// FIXME: due to an issue in mem_reg2aln(), we never come to this block. This does not affect accuracy, but it hurts performance.
cigar = malloc(4);
cigar[0] = l_query<<4 | 0;
*n_cigar = 1;
// UPDATE: we come to this block now... FIXME: due to an issue in mem_reg2aln(), we never come to this block. This does not affect accuracy, but it hurts performance.
if (n_cigar) {
cigar = malloc(4);
cigar[0] = l_query<<4 | 0;
*n_cigar = 1;
}
for (i = 0, *score = 0; i < l_query; ++i)
*score += mat[rseq[i]*5 + query[i]];
} else {

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h"
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.8-r740-dirty"
#define PACKAGE_VERSION "0.7.8-r741-dirty"
#endif
int bwa_fa2pac(int argc, char *argv[]);