samtools / htslib

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

changes to avoid segfault with uncompressed bam #1632

Closed vasudeva8 closed 1 year ago

vasudeva8 commented 1 year ago

Fix for #1617 when bam write is attempted with 'u', the bgzf compression/decompression buffers are not allocated as it denotes uncompressed output. bgzf_flush, called at end, accesses the compression buffers and causes segfault in such case.

Binary data files are implicitly expected to be bgzf compressed and this 'u' flag is not valid / supported.

The fix made is to remove the 'u' flag on write of bam/bcf that the output is written as bgzf compressed with default compression level.