From: Heng Li Date: Tue, 3 Feb 2009 10:43:11 +0000 (+0000) Subject: fixed a potential memory problem in indexing X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=47c65ef17d8949832a0c79c552118b31154bc2ad;hp=69b7f0f3ffd72fac57642fccc8c61aae2fd2ce36;p=samtools.git fixed a potential memory problem in indexing --- diff --git a/bam_index.c b/bam_index.c index 6bc735e..8c25552 100644 --- a/bam_index.c +++ b/bam_index.c @@ -158,7 +158,7 @@ bam_index_t *bam_index_core(bamFile fp) fprintf(stderr, "[bam_index_core] the alignment is not sorted. Abort!\n"); exit(1); } - if (b->core.bin < 4681) insert_offset2(&idx->index2[b->core.tid], b, last_off); + if (b->core.tid >= 0 && b->core.bin < 4681) insert_offset2(&idx->index2[b->core.tid], b, last_off); if (c->bin != last_bin) { // then possibly write the binning index if (save_bin != 0xffffffffu) // save_bin==0xffffffffu only happens to the first record insert_offset(idx->index[save_tid], save_bin, save_off, last_off); diff --git a/bamtk.c b/bamtk.c index 631502c..9b75ed6 100644 --- a/bamtk.c +++ b/bamtk.c @@ -3,7 +3,7 @@ #include "bam.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.1.2-3" +#define PACKAGE_VERSION "0.1.2-4" #endif int bam_taf2baf(int argc, char *argv[]);