Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when writing uncompressed BAM #1617

Closed
tijyojwad opened this issue May 5, 2023 · 2 comments
Closed

Segfault when writing uncompressed BAM #1617

tijyojwad opened this issue May 5, 2023 · 2 comments
Assignees

Comments

@tijyojwad
Copy link

Hi,

I am running into a segfault when I attempt to write a header into an uncompressed BAM. I'm opening the file using hts_open(fname, "wbu"). I tried with the commit 6143086502567c5c4bb5cacb2951f664ba28ed6e (release 1.17) but still see that issue.

The same code runs if I just change the mode to "wb".

Could that be looked into?
Thanks!

@tijyojwad
Copy link
Author

thanks to a tip from @cjw85 I learnt that wb0 did the trick for generating uncompressed BAMs. Could the API documentation be updated for that?

@daviesrob
Copy link
Member

u should work, and certainly shouldn't segfault. We'll look into it.

vasudeva8 added a commit to vasudeva8/htslib that referenced this issue Aug 17, 2023
Avoids segfault when writing bam/bcf with mode "wbu" by
changing "wbu" to "wb0".  The ensures the output file will
be properly wrapped in BGZF blocks, even though it's not
been compressed.

Fixes samtools#1617
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants