-
Notifications
You must be signed in to change notification settings - Fork 84
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 if read.aux() is called with a nonexistent tag #3
Comments
Hi, thanks for your effort to debug and name the problem in detail. We fixed the bug the way you suggested it and returning None if the aux tag is not available. Additionally all dependencies were updated to its newest Version - if this is important to anyone. Best |
Hi Ben,thank you very much for reporting and trying rust-htslib. I think I have fixed the bug in the master branch. Can you confirm?Thanks,JohannesOn Jul 2, 2015, at 7:36 PM, Ben Booth [email protected] wrote:I'm writing a tool to convert bam files to bedgraph/bigwig format using your library (See here), but I'm running into segfaults. The code I'm writing is checking each record for an XS tag to try and determine strandedness. This tag is completely optional, some BAM files won't have it. It seems like rust-htslib is currently segfaulting if you call read.aux() on a tag that isn't present in the record. Here is the output from rust-gdb: (gdb) run --bigwig --autostrand ~/analysis/dmel-all-r6.04.bdgp.autostrand.bam --out /data/analysis/nauRNAi/test/BS-2-nauRNAi-16-18-1_S12_L001_R1_001 /data/analysis/nauRNAi/test/BS-2-nauRNAi-16-18-1_S12_L001_R1_001.bam Program received signal SIGSEGV, Segmentation fault. /// Get auxiliary data (tags).
} |
It's working now! Thanks! |
I'm writing a tool to convert bam files to bedgraph/bigwig format using your library (See here), but I'm running into segfaults. The code I'm writing is checking each record for an XS tag to try and determine strandedness. This tag is completely optional, some BAM files won't have it. It seems like rust-htslib is currently segfaulting if you call read.aux() on a tag that isn't present in the record. Here is the output from rust-gdb:
I checked the source code listed in the stack trace:
The segfault is happening on the
match *aux
line. I'm not an expert in rust yet, but it looks like it's dereferencing the aux variable without checking if it's set to null (zero). I think bam_aux_get returns zero if there was no matching tag. Would it be possible to check for a null value returned, then return None from the aux method before dereferencing the aux variable? I think that would fix the segfaults. Thanks!The text was updated successfully, but these errors were encountered: