From 82797ab5f5ba03634967e19822e11a491c8e6198 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Thu, 2 Dec 2010 16:24:41 +0000 Subject: [PATCH] * samtools-0.1.11-1 (r858) * fixed a bug in mpileup which causes segfaults * bcftools: do not segfault when BCF contains errors --- bam_plcmd.c | 3 ++- bamtk.c | 2 +- bcftools/bcf.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bam_plcmd.c b/bam_plcmd.c index e3f73aa..002297a 100644 --- a/bam_plcmd.c +++ b/bam_plcmd.c @@ -563,9 +563,10 @@ static int mplp_func(void *data, bam1_t *b) mplp_aux_t *ma = (mplp_aux_t*)data; int ret, skip = 0; do { - int has_ref = (ma->ref && ma->ref_id == b->core.tid)? 1 : 0; + int has_ref; ret = ma->iter? bam_iter_read(ma->fp, ma->iter, b) : bam_read1(ma->fp, b); if (ret < 0) break; + has_ref = (ma->ref && ma->ref_id == b->core.tid)? 1 : 0; skip = 0; if (has_ref && (ma->flag&MPLP_REALN)) bam_prob_realn_core(b, ma->ref, 1); if (has_ref && ma->capQ_thres > 10) { diff --git a/bamtk.c b/bamtk.c index 4c2a4a2..116c45f 100644 --- a/bamtk.c +++ b/bamtk.c @@ -9,7 +9,7 @@ #endif #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.1.11 (r851)" +#define PACKAGE_VERSION "0.1.11-1 (r858)" #endif int bam_taf2baf(int argc, char *argv[]); diff --git a/bcftools/bcf.c b/bcftools/bcf.c index fd5c0c9..6e45695 100644 --- a/bcftools/bcf.c +++ b/bcftools/bcf.c @@ -181,7 +181,7 @@ int bcf_read(bcf_t *bp, const bcf_hdr_t *h, bcf1_t *b) } bgzf_read(bp->fp, b->str, b->l_str); l = 12 + b->l_str; - bcf_sync(b); + if (bcf_sync(b) < 0) return -2; for (i = 0; i < b->n_gi; ++i) { bgzf_read(bp->fp, b->gi[i].data, b->gi[i].len * h->n_smpl); l += b->gi[i].len * h->n_smpl; -- 2.39.2