diff options
author | Filippos Karapetis | 2010-06-16 21:59:21 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-16 21:59:21 +0000 |
commit | fa0011f51216d926d0922fba7bfb1ed65958dff2 (patch) | |
tree | 22a20c2e4e834ce79fef9d287737f67fd62b4ed8 /engines/sci/engine/kernel32.cpp | |
parent | 20d8de27bad1e9e8cd218c258ec863f89219b49c (diff) | |
download | scummvm-rg350-fa0011f51216d926d0922fba7bfb1ed65958dff2.tar.gz scummvm-rg350-fa0011f51216d926d0922fba7bfb1ed65958dff2.tar.bz2 scummvm-rg350-fa0011f51216d926d0922fba7bfb1ed65958dff2.zip |
Added a sanity check inside kMulDiv
svn-id: r49910
Diffstat (limited to 'engines/sci/engine/kernel32.cpp')
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index d35dd38792..7067e87c60 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -884,6 +884,12 @@ reg_t kMulDiv(EngineState *s, int argc, reg_t *argv) { int16 multiplier = argv[1].toSint16(); int16 denominator = argv[2].toSint16(); + // Sanity check... + if (!denominator) { + warning("kMulDiv: attempt to divide by zero (%d * %d / %d", multiplicant, multiplier, denominator); + return NULL_REG; + } + return make_reg(0, multiplicant * multiplier / denominator); } |