amplab / snap

Scalable Nucleotide Alignment Program -- a fast and accurate read aligner for high-throughput sequencing data
https://www.microsoft.com/en-us/research/project/snap/
Apache License 2.0
287 stars 66 forks source link

SNAP crashes when it tries to generate a BAM file with > 2GB header #76

Open bolosky opened 8 years ago

bolosky commented 8 years ago

The BAM spec has the header size as signed 32 bit int, so it's not possible to have one with more than 2GB of header (because you have so many contigs that it takes that much space). Since it's in the spec, there's nothing to be done about it. However, SNAP just shoves the size into the _int32 field, which can result in a negative offset and a crash (or, if it's big enough, with a positive-but-incorrect offset). It should detect this and exit with a helpful error message.