Skip to content

Commit c57cdd8

Browse files
committed
Merge branch 'develop' of github.com:samtools/bcftools into develop
2 parents 83dad30 + db17826 commit c57cdd8

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Changes affecting specific commands:
2222

2323
- Add new FORMAT/QM annotation, to be used with the new `bcftools +trio-dnm3 --use-ALM` model.
2424

25+
* bcftools norm
26+
27+
- Fix a bug in splitting Type=String FORMAT fields via -a and -m (#2476)
28+
2529
* bcftools +prune
2630

2731
- When pruning by window length in base pairs, one out-of-window record would

abuf.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* The MIT License
22
3-
Copyright (c) 2021-2024 Genome Research Ltd.
3+
Copyright (c) 2021-2026 Genome Research Ltd.
44
55
Author: Petr Danecek <pd3@sanger.ac.uk>
66
@@ -630,8 +630,9 @@ static void _split_table_set_format(abuf_t *buf, bcf_fmt_t *fmt, merge_rule_t mo
630630
memset(buf->tmp2,0,nval1_dst*nsmpl);
631631
for (i=0; i<nsmpl; i++)
632632
{
633+
char *src = (char*)buf->tmp2 + nval1_dst*i;
633634
kstring_t dst;
634-
dst.l = 0; dst.m = nval1_dst; dst.s = (char*)buf->tmp2 + nval1_dst*i;
635+
dst.l = 0; dst.m = nval1_dst + 1; dst.s = src;
635636
kputc_('.',&dst);
636637
if ( star_allele ) kputsn_(",.",2,&dst);
637638
if ( len==BCF_VL_R )
@@ -641,6 +642,7 @@ static void _split_table_set_format(abuf_t *buf, bcf_fmt_t *fmt, merge_rule_t mo
641642
}
642643
copy_string_field(buf->tmp+nval1*i, iori+ioff, nval1, &dst, 0+ioff);
643644
if ( star_allele ) copy_string_field(".", 0, 1, &dst, 1+ioff);
645+
assert( src==dst.s ); // make sure copy_string_field() did not reallocate
644646
}
645647
ret = bcf_update_format(buf->out_hdr, out, tag, buf->tmp2, nval1_dst*nsmpl, type);
646648
}

0 commit comments

Comments
 (0)