From 876a83024db3eef893cdc14dcf1377fd867331cf Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 2 Nov 2013 11:20:26 +1100 Subject: [PATCH] Sanity check for absurd target setting and divide by zero. --- cgminer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cgminer.c b/cgminer.c index 2ea0d1f7..76bfcc2b 100644 --- a/cgminer.c +++ b/cgminer.c @@ -3114,6 +3114,8 @@ static void calc_diff(struct work *work, double known) if (opt_scrypt) d64 *= (double)65536; dcut64 = le256todouble(work->target); + if (unlikely(!dcut64)) + dcut64 = 1; work->work_difficulty = d64 / dcut64; } difficulty = work->work_difficulty;