As a naive workaround, the following simple patch would prevent division
by zero and SIGFPE:

 int round_div(int num, int den)
 {
-    return (num + (den / 2)) / den;
+    return den ? (num + (den / 2)) / den : 0;
 }

Reported values now would be zeros, which is certainly wrong, but at
least the program no longer crashes:

...
XTAL: 27.0 MHz, RefDiv: 0

Core: 0.0 MHz, Mem: 0.0 MHz

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/493220

Title:
  Rovclock crashes with floating-point exception

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rovclock/+bug/493220/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to