[med-svn] [htslib] 09/10: Stop threaded bgzf_read_block from using stale values at EOF
Andreas Tille
tille at debian.org
Wed Jul 19 19:54:29 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to annotated tag 1.5
in repository htslib.
commit fba943d63bd06b5691b720253f65b6cf6673b23f
Author: Rob Davies <rmd+git at sanger.ac.uk>
Date: Tue Jun 20 09:41:38 2017 +0100
Stop threaded bgzf_read_block from using stale values at EOF
j->block_address is not filled out at EOF, so should
not be used. Also initialize comp_len to zero, in
sace anything tries to use that.
Fixes samtools/samtools#687 (samtools 1.4.1 bai indices created
with multiple threads can lose reads)
---
bgzf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bgzf.c b/bgzf.c
index c8a53db..7e80b8c 100644
--- a/bgzf.c
+++ b/bgzf.c
@@ -644,7 +644,7 @@ int bgzf_read_block(BGZF *fp)
// block_length=0 and block_offset set by bgzf_seek.
if (fp->block_length != 0) fp->block_offset = 0;
- fp->block_address = j->block_address;
+ if (!j->hit_eof) fp->block_address = j->block_address;
fp->block_clength = j->comp_len;
fp->block_length = j->uncomp_len;
// bgzf_read() can change fp->block_length
@@ -1088,6 +1088,7 @@ restart:
bgzf_job *j = pool_alloc(mt->job_pool);
pthread_mutex_unlock(&mt->job_pool_m);
j->errcode = 0;
+ j->comp_len = 0;
j->uncomp_len = 0;
j->hit_eof = 0;
@@ -1123,6 +1124,7 @@ restart:
j = pool_alloc(mt->job_pool);
pthread_mutex_unlock(&mt->job_pool_m);
j->errcode = 0;
+ j->comp_len = 0;
j->uncomp_len = 0;
j->hit_eof = 0;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/htslib.git
More information about the debian-med-commit
mailing list