From 7fd6a11569f84540642071e3c4f39068d586fdbc Mon Sep 17 00:00:00 2001 From: Heng Li Date: Thu, 10 Jul 2014 10:53:56 -0400 Subject: [PATCH] r788: segfault when the last ref is "weird" mem_patch_reg() did not check if two hits are on the same strand, which may lead to an alignment bridging the forward-backward boundary. --- bwamem.c | 1 + main.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bwamem.c b/bwamem.c index c0c7fa9..e9d9304 100644 --- a/bwamem.c +++ b/bwamem.c @@ -383,6 +383,7 @@ int mem_patch_reg(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, double r; if (bns == 0 || pac == 0 || query == 0) return 0; assert(a->rid == b->rid && a->rb <= b->rb); + if (a->rb < bns->l_pac && b->rb >= bns->l_pac) return 0; // on different strands if (a->qb >= b->qb || a->qe >= b->qe || a->re >= b->re) return 0; // not colinear w = (a->re - b->rb) - (a->qe - b->qb); // required bandwidth w = w > 0? w : -w; // l = abs(l) diff --git a/main.c b/main.c index dfa02c2..4be18a2 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "utils.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.7.9a-r787-dirty" +#define PACKAGE_VERSION "0.7.9a-r788-dirty" #endif int bwa_fa2pac(int argc, char *argv[]);