Skip to content

Prevent s_long from being zero #3285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/pulse_slicer.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ int pulse_slicer_pcm(pulse_data_t const *pulses, r_device *device)
int events = 0;
bitbuffer_t bits = {0};

// Prevent divide-by-zero
if (s_long <= 0) {
return 0;
}

int const gap_limit = s_gap ? s_gap : s_reset;
int const max_zeros = gap_limit / s_long;
if (s_tolerance <= 0)
Expand Down
Loading