Skip to content

Commit

Permalink
fix crash with population size 0 in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaller committed Apr 12, 2024
1 parent 783df79 commit 148fc94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Note that not every commit will be logged here; that is what the Github commit h


development head (in the master branch):

fix a crash when BorrowShuffleBuffer() is called with size zero, unfortunately introduced when debugging a different problem


version 4.2 (Eidos version 3.2):
fix for #418, a crash involving null genomes in nonWF (has_null_genomes_ was not set correctly by addCloned() or takeMigrants() when putting a null genome into a subpop that previously had none)
Expand Down
5 changes: 5 additions & 0 deletions core/species.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3117,7 +3117,12 @@ slim_popsize_t *Species::BorrowShuffleBuffer(slim_popsize_t p_buffer_size)
if (shuffle_buf_borrowed_)
EIDOS_TERMINATION << "ERROR (Species::BorrowShuffleBuffer): (internal error) shuffle buffer already borrowed." << EidosTerminate();

#if DEBUG_SHUFFLE_BUFFER
// guarantee allocation even with a p_buffer_size of 0, so we have a place to put our overrun barriers
if ((p_buffer_size > shuffle_buf_capacity_) || (p_buffer_size == 0))
#else
if (p_buffer_size > shuffle_buf_capacity_)
#endif
{
if (shuffle_buffer_)
free(shuffle_buffer_);
Expand Down

0 comments on commit 148fc94

Please sign in to comment.