Skip to content

Fix UB in file_merging_iterator sentinel and is_member comparison#90

Merged
jermp merged 1 commit intojermp:masterfrom
rob-p:fix/file-merging-sentinel
Mar 10, 2026
Merged

Fix UB in file_merging_iterator sentinel and is_member comparison#90
jermp merged 1 commit intojermp:masterfrom
rob-p:fix/file-merging-sentinel

Conversation

@rob-p
Copy link
Contributor

@rob-p rob-p commented Mar 10, 2026

file_merging_iterator used std::numeric_limits::max() as a sentinel value, but minimizer_tuple has no std::numeric_limits specialization. This returns a default-constructed object with uninitialized members (UB), causing segfaults when merging >16 minimizer files via the winner tree path. Use T::max() instead, which minimizer_tuple properly defines.

Also fix is_member() which compared lookup_result directly against uint64_t instead of comparing lookup_result.kmer_id.

file_merging_iterator used std::numeric_limits<T>::max() as a sentinel
value, but minimizer_tuple has no std::numeric_limits specialization.
This returns a default-constructed object with uninitialized members
(UB), causing segfaults when merging >16 minimizer files via the
winner tree path. Use T::max() instead, which minimizer_tuple properly
defines.

Also fix is_member() which compared lookup_result directly against
uint64_t instead of comparing lookup_result.kmer_id.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jermp
Copy link
Owner

jermp commented Mar 10, 2026

Thank you, Claude Patro! :D

@jermp jermp merged commit 5a9d479 into jermp:master Mar 10, 2026
9 checks passed
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