From c62ac89081080d1f55b707ccaa9635bebaa439d8 Mon Sep 17 00:00:00 2001 From: XMRig Date: Thu, 12 Dec 2019 14:09:18 +0700 Subject: [PATCH] Fixed potential division by 0. --- src/base/net/stratum/Job.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/net/stratum/Job.h b/src/base/net/stratum/Job.h index 9e1f3bc98..ed369a163 100644 --- a/src/base/net/stratum/Job.h +++ b/src/base/net/stratum/Job.h @@ -99,7 +99,7 @@ public: # endif static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast(blob + 39); } - static inline uint64_t toDiff(uint64_t target) { return 0xFFFFFFFFFFFFFFFFULL / target; } + static inline uint64_t toDiff(uint64_t target) { return target ? (0xFFFFFFFFFFFFFFFFULL / target) : 0; } inline bool operator!=(const Job &other) const { return !isEqual(other); } inline bool operator==(const Job &other) const { return isEqual(other); }