diff options
author | Steve Peters <steve@fisharerojo.org> | 2006-02-11 06:14:02 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-02-11 06:14:02 +0000 |
commit | ece1bcefc6e1d5c666cb173e3db4fb5c6663a8b9 (patch) | |
tree | 52cbcc6b0ed232c1281c56ab8e01dcd661a57a71 /pp.c | |
parent | c2b4a044213bea86e9e2d063d8cade83f2b9aa8b (diff) | |
download | perl-ece1bcefc6e1d5c666cb173e3db4fb5c6663a8b9.tar.gz |
Die when integer overflow condition is detected in division under
C<use integer>. Hopefully fixes RT #38485.
p4raw-id: //depot/perl@27155
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -2423,12 +2423,16 @@ PP(pp_i_multiply) PP(pp_i_divide) { + IV num; dVAR; dSP; dATARGET; tryAMAGICbin(div,opASSIGN); { dPOPiv; if (value == 0) - DIE(aTHX_ "Illegal division by zero"); - value = POPi / value; + DIE(aTHX_ "Illegal division by zero"); + num = POPi; + if (num == IV_MIN && value == -1) + DIE(aTHX_ "Integer overflow in division"); + value = num / value; PUSHi( value ); RETURN; } |