Skip to content

Fix vcfconvert ALT parsing, null deref, and sample compression#2528

Open
sirus20x6 wants to merge 1 commit intosamtools:developfrom
sirus20x6:fix/vcfconvert-parsing
Open

Fix vcfconvert ALT parsing, null deref, and sample compression#2528
sirus20x6 wants to merge 1 commit intosamtools:developfrom
sirus20x6:fix/vcfconvert-parsing

Conversation

@sirus20x6
Copy link
Copy Markdown

Summary

  • Fix ALT allele scanning in _set_chrom_pos_ref_alt — while loop checked *tsv->se (constant end pointer) instead of *se (scan pointer), making it a no-op
  • Add NULL guard before bgzf_thread_pool(hout, ...) when hap output is suppressed with .
  • Fix sample_compressed = 0 to = 1 in three places — .gz sample filenames were never actually compressed

Test plan

  • Existing test suite passes (1920/1920)
  • Verify CHROM:POS_REF_ALT format parsing in convert
  • Verify .gz sample output files are compressed

1. _set_chrom_pos_ref_alt (~line 207): The while/if conditions checked
   isspace_c(*tsv->se) (the constant end pointer) instead of
   !isspace_c(*se) (the advancing scan pointer), causing the ALT allele
   scan to terminate immediately or never advance.

2. bgzf_thread_pool calls (~lines 1084, 1234): Added NULL check for hout
   before calling bgzf_thread_pool, preventing a crash when hap output
   is suppressed by passing '.' as the filename.

3. sample_compressed assignment (~lines 923, 1048, 1197): Changed
   `sample_compressed = 0` to `sample_compressed = 1` so that .gz
   sample filenames actually enable compressed output.
@sirus20x6 sirus20x6 force-pushed the fix/vcfconvert-parsing branch from b573161 to b23579b Compare March 26, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant