Skip to content

Commit

Permalink
Fixes BCF in-memory decoding with 64-bit integers.
Browse files Browse the repository at this point in the history
Any 64-bit INFO field that wasn't the last in the list would cause
subsequent fields to be decoded incorrectly.

This commit fixes that, plus updates the tests accordingly so the bug
could be triggered.

Fixes the first part of #999 (test1.vcf), but doesn't fix the second
part (BCF output silently being broken).

Fixes samtools/bcftools#1123
  • Loading branch information
jkbonfield committed Dec 9, 2019
1 parent 5e7b76b commit ed4c281
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/longrefs/index.expected2.vcf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1 10010000110 . G <DEL> 0 . SVTYPE=DEL;SVLEN=-890;END=10010001000 PL 0,1,45
1 10010000110 . G <DEL> 0 . SVTYPE=DEL;SVLEN=-890;END=10010001000;QS=1,0 PL 0,1,45
2 changes: 1 addition & 1 deletion test/longrefs/index.vcf
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,4 @@
1 10010000107 . G <*> 0 . DP=1;I16=0,1,0,0,33,1089,0,0,29,841,0,0,2,4,0,0;QS=1,0;MQ0F=0 PL 0,3,29
1 10010000108 . C <*> 0 . DP=1;I16=0,1,0,0,32,1024,0,0,29,841,0,0,1,1,0,0;QS=1,0;MQ0F=0 PL 0,3,29
1 10010000109 . A <*> 0 . DP=1;I16=0,1,0,0,35,1225,0,0,29,841,0,0,0,0,0,0;QS=1,0;MQ0F=0 PL 0,3,29
1 10010000110 . G <DEL> 0 . SVTYPE=DEL;SVLEN=-890;END=10010001000 PL 0,1,45
1 10010000110 . G <DEL> 0 . SVTYPE=DEL;SVLEN=-890;END=10010001000;QS=1,0 PL 0,1,45
2 changes: 1 addition & 1 deletion vcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ HTSLIB_EXPORT
uint32_t bcf_float_vector_end = 0x7F800002;

HTSLIB_EXPORT
uint8_t bcf_type_shift[] = { 0, 0, 1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t bcf_type_shift[] = { 0, 0, 1, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

static bcf_idinfo_t bcf_idinfo_def = { .info = { 15, 15, 15 }, .hrec = { NULL, NULL, NULL}, .id = -1 };

Expand Down

0 comments on commit ed4c281

Please sign in to comment.