Skip to content

Commit

Permalink
Fix undefined behavior affecting consensus tree building for trees wi…
Browse files Browse the repository at this point in the history
…th 32N leaves
  • Loading branch information
BenoitMorel committed Jun 28, 2023
1 parent 1780193 commit 5f5f03f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tree/consensus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1109,11 +1109,12 @@ static void reverse_split(pll_split_t split, unsigned int tip_count)
unsigned int split_len = tip_count / split_size + (split_offset>0);
unsigned int i;

if (!split_offset) split_offset = split_size;

for (i=0; i<split_len; ++i)
split[i] = ~split[i];

if (!split_offset)
return;

pll_split_base_t mask = (1u<<split_offset) - 1;
split[split_len - 1] &= mask;
}
Expand Down

0 comments on commit 5f5f03f

Please sign in to comment.