samtools / htslib

C library for high-throughput sequencing data formats
Other
784 stars 447 forks source link

bgzf_useek fails when offset is above block limits #1668

Closed vasudeva8 closed 10 months ago

vasudeva8 commented 10 months ago

A bgzip read with an offset asserts when the offset is invalid / above the file limit. The assertion was from bgzf_useek when the offset position is beyond the uncompressed file size. It is modified to return a failure in such case to avoid the assertion.

It might even be OK to remove the assertion but the "todo" comment along with it indicates some unclear case that an explicit failure seems better.