Skip to content

Commit

Permalink
Update NEWS and prevent negative rlen on erroneous INFO/END, samtools…
Browse files Browse the repository at this point in the history
  • Loading branch information
pd3 committed Dec 17, 2019
1 parent ca2f667 commit ea879e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
9 changes: 9 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Noteworthy changes in release a.b
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Noteworthy changes in release 1.10.1 (17th December 2019)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The support for 64-bit coordinates in VCF brought problems for files
not conforming to VCF/BCF specification. While previous versions would
make out-of-range values silently overflow creating nonsense values
but parseable file, the version 1.10 would silently create an invalid BCF.


Noteworthy changes in release 1.10 (6th December 2019)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
15 changes: 13 additions & 2 deletions vcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2521,7 +2521,7 @@ static int vcf_parse_format(kstring_t *s, const bcf_hdr_t *h, bcf1_t *v, char *p

int vcf_parse(kstring_t *s, const bcf_hdr_t *h, bcf1_t *v)
{
static int extreme_int_warned = 0;
static int extreme_int_warned = 0, negative_rlen_warned = 0;
int i = 0;
char *p, *q, *r, *t;
kstring_t *str;
Expand Down Expand Up @@ -2786,7 +2786,18 @@ int vcf_parse(kstring_t *s, const bcf_hdr_t *h, bcf1_t *v)
bcf_enc_vint(str, n_val, val_a, -1);
}
if (n_val==1 && strcmp(key, "END") == 0)
v->rlen = val1 - v->pos;
{
if ( val1 <= v->pos )
{
if ( !negative_rlen_warned )
{
hts_log_warning("INFO/END=%"PRIhts_pos" is smaller than POS at %s:%"PRIhts_pos,val1,bcf_seqname(h,v),v->pos+1);
negative_rlen_warned = 1;
}
}
else
v->rlen = val1 - v->pos;
}
} else if ((y>>4&0xf) == BCF_HT_REAL) {
float *val_f = (float *)val_a;
for (i = 0, t = val; i < n_val; ++i, ++t)
Expand Down

0 comments on commit ea879e1

Please sign in to comment.