Skip to content

Commit

Permalink
Reset variant types after updating alleles
Browse files Browse the repository at this point in the history
Variant type calls produced by bcf_set_variant_types() may be
stale after updating alleles via bcf_update_alleles() or
bcf_update_alleles_str(), so set d.var_type to -1 to force
a recalculation.

Fixes an out of bounds access in bcftools consensus that occurred
when it added a new allele to a record.
  • Loading branch information
daviesrob committed Jan 30, 2025
1 parent 2578c89 commit c814d39
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions vcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -5495,6 +5495,7 @@ int bcf_has_filter(const bcf_hdr_t *hdr, bcf1_t *line, char *filter)
static inline int _bcf1_sync_alleles(const bcf_hdr_t *hdr, bcf1_t *line, int nals)
{
line->d.shared_dirty |= BCF1_DIRTY_ALS;
line->d.var_type = -1;

line->n_allele = nals;
hts_expand(char*, line->n_allele, line->d.m_allele, line->d.allele);
Expand Down

0 comments on commit c814d39

Please sign in to comment.