[OpenBIOS] [PATCH 9/10] Divide by zero check
William Hahne
will07c5 at gmail.com
Tue Aug 9 23:55:10 CEST 2011
It is possible for BootX to purposefully divide by zero expecting 0 as the
result.
Index: kernel/forth.c
===================================================================
--- kernel/forth.c (revision 1041)
+++ kernel/forth.c (working copy)
@@ -1157,6 +1157,12 @@
{
const ucell b = POP();
const ducell a = DPOP();
+
+ if (b == 0) { // can't divide by zero
+ PUSH(0);
+ DPUSH(0);
+ return;
+ }
#ifdef NEED_FAKE_INT128_T
if (a.hi != 0) {
fprintf(stderr, "mudivmod called (0x%016llx %016llx /
0x%016llx)\n",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20110809/7b73454c/attachment-0001.html>
More information about the OpenBIOS
mailing list