Skip to content
Snippets Groups Projects

Fix (possible) segfaults throughout code in kernel calls

Merged Josh Borrow requested to merge fix_black_hole_segfault_crash into master
1 unresolved thread

Throughout the code there was the following pattern used:

/* Get r and 1/r. */
// r2 = 0, so r_inv is inf
const float r_inv = 1.0f / sqrtf(r2);
// 0 / inf = - nan
const float r = r2 * r_inv;
// - nan again
const float ui = r * hi_inv;
// branch for - nan? segfault, as 0 < ui < kernel_gamma
kernel_deval(ui, &wi, &wi_dx);

causing segfaults in the kernel_deval if r2=0.0. This PR addresses this issue throughout (apart from in the gravity, where I have left it unchecked).

It also adds a random offset to the black holes when they are repositioned, so that they are never repositioned on top of gas particles (@dc-bahe1).

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading