Skip to content

Commit

Permalink
merge_format_string: Enlarge array for BCF_VL_A/BCF_VL_R too
Browse files Browse the repository at this point in the history
Fixes samtools#1353. Lengthen strings in merge.6.b.vcf to such an extent that
merge_format_string() crashes on this test case without this fix.
  • Loading branch information
jmarshall committed Nov 30, 2020
1 parent 0987715 commit ff5dc52
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions test/merge.6.a.vcf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
##contig=<ID=1,length=248956422>
##reference=file:///home/dnanexus/genome.fa
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT t1
1 11080563 . A C . . . GT:RFS:AFS 0/1:a,c:c
1 11080564 . A C . . . GT:RFS:AFS 0/1:a,c:c
1 11080563 . A C . . . GT:RFS:AFS 0/1:aa,c:c
1 11080564 . A C . . . GT:RFS:AFS 0/1:a,cc:c
2 changes: 1 addition & 1 deletion test/merge.6.b.vcf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
##reference=file:///home/dnanexus/genome.fa
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT t2
1 11080563 . A C . . . GT:FFS:AFS:RFS 0/1:xx,yy:C:A,C
1 11080564 . A T . . . GT:FFS:AFS:RFS 0/1:xx,yy:T:A,T
1 11080564 . A T . . . GT:FFS:AFS:RFS 0/1:xx,yy:TTTTATGCATGCATGCTTTTTTTTATGCATGCATGCTTTT:A,T
4 changes: 2 additions & 2 deletions test/merge.6.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
##reference=file:///home/dnanexus/genome.fa
##FORMAT=<ID=FFS,Number=2,Type=String,Description="Some string">
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT t1 t2
1 11080563 . A C . . . GT:RFS:AFS:FFS 0/1:a,c:c:. 0/1:A,C:C:xx,yy
1 11080564 . A C,T . . . GT:RFS:AFS:FFS 0/1:a,c,.:c,.:. 0/2:A,.,T:.,T:xx,yy
1 11080563 . A C . . . GT:RFS:AFS:FFS 0/1:aa,c:c:. 0/1:A,C:C:xx,yy
1 11080564 . A C,T . . . GT:RFS:AFS:FFS 0/1:a,cc,.:c,.:. 0/2:A,.,T:.,TTTTATGCATGCATGCTTTTTTTTATGCATGCATGCTTTT:xx,yy
1 change: 1 addition & 0 deletions vcfmerge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,7 @@ void merge_format_string(args_t *args, const char *key, bcf_fmt_t **fmt_map, bcf
int ret = copy_string_field(src, iori - ifrom, fmt_ori->size, str, inew);
if ( ret<-1 ) error("[E::%s] fixme: internal error at %s:%"PRId64" .. %d\n",__func__,bcf_seqname(hdr,line),(int64_t) line->pos+1,ret);
}
if ( nmax < str->l ) nmax = str->l;
src += fmt_ori->size;
}
continue;
Expand Down

0 comments on commit ff5dc52

Please sign in to comment.