From: James Bonfield <jkb@sa...> - 2013-03-18 14:35:18
In Samtools, there appears to be an upper-bound on the B byte array
parsing with unsigned values.
Consider the follow stress test of auxiliary strings:
Converting from SAM to BAM to SAM with the newly released 0.1.19 (or
The signed values came out OK, but the unsigned ones get truncated
to INT_MAX rather than UINT_MAX.
The error appears to be in the sam to bam code rather than the bam to
sam conversion, caused by using strtol() in bam_import.c. Given
2147483648 on my 32-bit desktop this caps the value at 2147483647 and
sets errno to ERANGE.
Switching to strtoll() at bam_import.c:455 solves this, although
introduces other issues for when the value is out of range
elsewhere. Ideally it would need additional error checking, although
I'm not sure how it should return range errors back to the user.
 A minor typo in the spec: the SAM definition for auxiliary code "i"
refers to these as "singed", which made me smile.
James Bonfield (jkb@...) | Hora aderat briligi. Nunc et Slythia Tova
| Plurima gyrabant gymbolitare vabo;
A Staden Package developer: | Et Borogovorum mimzebant undique formae,
https://sf.net/projects/staden/ | Momiferique omnes exgrabure Rathi.
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.