|
From: Christopher S. <Chr...@cr...> - 2014-08-08 09:49:39
|
Hi devs,
Found a bug in htslib (Github master) today: bgzf_seek seeks to the right
address, but then writes a bad block_address to its BGZF structure. The
bug usually doesn't manifest because bgzf_read overwrites block_address
with the result of an htell call, which is still correct; however, if one
calls bgzf_seek immediately followed by bgzf_tell without an intervening
read, as seen in at least Cufflinks 2.2.1, the result is incorrect and
leads to problems when it is later used to seek.
Specifically, the BGZF structure contains a block_address (file offset of
this block) and a block_offset (offset within block), which are encoded
into an int64 by (block_offset & 0xffff | block_address << 16). bgzf_seek
correctly decodes the input int64 and uses it to seek, but then stores
block_address << 16, rather than block_address, into the BGZF structure.
I attach the one-line patch that fixes this bug.
Chris
________________________________
This email is confidential and intended solely for the use of the person(s) ('the intended recipient') to whom it was addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of the Cancer Research UK Manchester Institute or the University of Manchester. It may contain information that is privileged & confidential within the meaning of applicable law. Accordingly any dissemination, distribution, copying, or other use of this message, or any of its contents, by any person other than the intended recipient may constitute a breach of civil or criminal law and is strictly prohibited. If you are NOT the intended recipient please contact the sender and dispose of this e-mail as soon as possible.
|