Skip to content

Stop bgzf_index_dump_hfile() from writing invalid item counts#1988

Merged
vasudeva8 merged 1 commit intosamtools:developfrom
daviesrob:bad-gzi-prevention
Mar 5, 2026
Merged

Stop bgzf_index_dump_hfile() from writing invalid item counts#1988
vasudeva8 merged 1 commit intosamtools:developfrom
daviesrob:bad-gzi-prevention

Conversation

@daviesrob
Copy link
Member

@daviesrob daviesrob commented Mar 5, 2026

Adds fp->idx->noffs > 0 checks before decrementing the item count written to GZI indexes. Fixes a bug where the wrong value was written when compressing and GZI indexing an empty file. Note that since 6dd0d7d, files exhibiting this bug will be rejected by bgzf_index_load_hfile().

Thanks to Matthieu Muffato for reporting this bug.

Adds `fp->idx->noffs > 0` checks before decrementing the item
count written to GZI indexes.  Fixes a bug where the wrong
value was written when compressing and GZI indexing an empty
file.  Note that since 6dd0d7d, files exhibiting this bug
will be rejected by bgzf_index_load_hfile().

Thanks to Matthieu Muffato for reporting this bug.
@daviesrob daviesrob force-pushed the bad-gzi-prevention branch from cf2d738 to cf6bb09 Compare March 5, 2026 14:47
@vasudeva8 vasudeva8 merged commit ca58677 into samtools:develop Mar 5, 2026
9 checks passed
@daviesrob daviesrob deleted the bad-gzi-prevention branch March 5, 2026 16:18
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.

2 participants