mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-02 21:54:10 +08:00
coverity 227889 227898 - division by zero
This commit is contained in:
parent
2024f87ed3
commit
e4ad1a7471
1 changed files with 10 additions and 4 deletions
|
@ -117,8 +117,11 @@ void computeSignalProperties(uint8_t *samples, uint32_t size) {
|
|||
|
||||
sum += samples[i];
|
||||
cnt++;
|
||||
}
|
||||
signalprop.mean = sum / cnt;
|
||||
}
|
||||
if (cnt > 0)
|
||||
signalprop.mean = sum / cnt;
|
||||
else
|
||||
signalprop.mean = 0;
|
||||
#else
|
||||
for (uint32_t i = SIGNAL_IGNORE_FIRST_SAMPLES; i < size; i++) {
|
||||
if (samples[i] < signalprop.low) signalprop.low = samples[i];
|
||||
|
@ -160,8 +163,11 @@ void removeSignalOffset(uint8_t *samples, uint32_t size) {
|
|||
|
||||
acc_off += samples[i] - 128;
|
||||
cnt++;
|
||||
}
|
||||
acc_off /= cnt;
|
||||
}
|
||||
if (cnt > 0)
|
||||
acc_off /= cnt;
|
||||
else
|
||||
acc_off = 0;
|
||||
#else
|
||||
for (uint32_t i = SIGNAL_IGNORE_FIRST_SAMPLES; i < size; i++)
|
||||
acc_off += samples[i] - 128;
|
||||
|
|
Loading…
Reference in a new issue