diff options
author | Guido van Rossum <guido@python.org> | 1999-09-27 17:12:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-09-27 17:12:47 (GMT) |
commit | e13ff2e2d6ddc6dead2d804006d8320df27dc553 (patch) | |
tree | 57600e339b72a93b17b293af59fe299c778ef1b2 /Objects/intobject.c | |
parent | 1a23c2484ece91d06f75d9ebdaf2ada951c87c82 (diff) | |
download | cpython-e13ff2e2d6ddc6dead2d804006d8320df27dc553.zip cpython-e13ff2e2d6ddc6dead2d804006d8320df27dc553.tar.gz cpython-e13ff2e2d6ddc6dead2d804006d8320df27dc553.tar.bz2 |
Patch by Tim Peters fixing PR#88:
Integer division can crash under Windows.
Diffstat (limited to 'Objects/intobject.c')
-rw-r--r-- | Objects/intobject.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c index 7293515..f2d77e1 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -434,8 +434,14 @@ i_divmod(x, y, p_xdivy, p_xmody) return -1; } if (yi < 0) { - if (xi < 0) + if (xi < 0) { + if (yi == -1 && -xi < 0) { + /* most negative / -1 */ + err_ovf("integer division"); + return -1; + } xdivy = -xi / -yi; + } else xdivy = - (xi / -yi); } |