Let's suppose I generate a binary VCF with a gapped BCF_DT_ID table:
$ echo -e "##fileformat=VCFv4.2\n#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO" | \
bcftools view --no-version -Ou -c0 | \
bcftools annotate --no-version -Ou -x INFO/AC
BCF�##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed",IDX=0>
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes",IDX=2>
#CHROM POS ID REF ALT QUAL FILTER INFO
And the problem is that it tries to access (hdr)->id[BCF_DT_ID][int_id].val without first verifying that it exists. And there is no attempt at verifying that int_id might refer to a gap in the BCF_DT_ID table.
Is this the intended behavior or should the bcf_hdr_idinfo_exists(hdr,type,int_id) macro be amended to first check that (hdr)->id[BCF_DT_ID][int_id].val indeed exists? Or what should be the proper way to loop through all the INFO fields in the header?
Let's suppose I generate a binary VCF with a gapped BCF_DT_ID table:
Where now the
IDX=1
entry is gone.Now I generate a simple executable:
If I pipe the previous binary VCF into this executable:
I get that
bcf_hdr_idinfo_exists(hdr,type,int_id)
causes segmentation fault. This macro is defined inhtslib/vcf.h
as follows:And the problem is that it tries to access
(hdr)->id[BCF_DT_ID][int_id].val
without first verifying that it exists. And there is no attempt at verifying thatint_id
might refer to a gap in the BCF_DT_ID table.Is this the intended behavior or should the
bcf_hdr_idinfo_exists(hdr,type,int_id)
macro be amended to first check that(hdr)->id[BCF_DT_ID][int_id].val
indeed exists? Or what should be the proper way to loop through all the INFO fields in the header?