mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-08 21:14:14 +00:00
Add a sanity check to avoid divide by zero crashes in set_target
This commit is contained in:
parent
8abe9d4e39
commit
e95b42ea54
@ -5926,6 +5926,12 @@ void set_target(unsigned char *dest_target, double diff)
|
|||||||
uint64_t *data64, h64;
|
uint64_t *data64, h64;
|
||||||
double d64, dcut64;
|
double d64, dcut64;
|
||||||
|
|
||||||
|
if (unlikely(diff == 0.0)) {
|
||||||
|
/* This shouldn't happen but best we check to prevent a crash */
|
||||||
|
applog(LOG_ERR, "Diff zero passed to set_target");
|
||||||
|
diff = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
d64 = truediffone;
|
d64 = truediffone;
|
||||||
if (opt_scrypt)
|
if (opt_scrypt)
|
||||||
d64 *= (double)65536;
|
d64 *= (double)65536;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user