mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-20 20:18:17 +08:00
fix coverity div by zero
This commit is contained in:
parent
cc93354148
commit
9ecbe2da41
1 changed files with 7 additions and 4 deletions
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#define TEXKOM_NOISE_THRESHOLD (10)
|
#define TEXKOM_NOISE_THRESHOLD (10)
|
||||||
|
|
||||||
inline uint32_t GetGraphBuffer(uint32_t indx) {
|
static inline uint32_t GetGraphBuffer(uint32_t indx) {
|
||||||
if (g_GraphBuffer[indx] < -128)
|
if (g_GraphBuffer[indx] < -128)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
@ -154,7 +154,10 @@ static bool TexkomCalculateBitLengths(uint32_t *data, uint32_t len, uint32_t *hi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lenhi)
|
||||||
*hi = sumhi / lenhi;
|
*hi = sumhi / lenhi;
|
||||||
|
|
||||||
|
if (lenlow)
|
||||||
*low = sumlow / lenlow;
|
*low = sumlow / lenlow;
|
||||||
|
|
||||||
if (lmax != NULL)
|
if (lmax != NULL)
|
||||||
|
@ -165,7 +168,7 @@ static bool TexkomCalculateBitLengths(uint32_t *data, uint32_t len, uint32_t *hi
|
||||||
return (*hi != 0) && (*low != 0) && (*hi > *low);
|
return (*hi != 0) && (*low != 0) && (*hi > *low);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool TexcomCalculateBit(uint32_t data, uint32_t bitlen, uint32_t threshold) {
|
static inline bool TexcomCalculateBit(uint32_t data, uint32_t bitlen, uint32_t threshold) {
|
||||||
return
|
return
|
||||||
(data < (bitlen + threshold)) &&
|
(data < (bitlen + threshold)) &&
|
||||||
(data > (bitlen - threshold));
|
(data > (bitlen - threshold));
|
||||||
|
|
Loading…
Add table
Reference in a new issue