derick Sun Feb 22 15:07:18 2004 EDT Added files: (Branch: PHP_4_3) /php-src/tests/lang bug27354.phpt
Modified files: /php-src NEWS /Zend zend_operators.c Log: - MFH: Fixed bug #27354 (Modulus operator crashes PHP). http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.572&r2=1.1247.2.573&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.572 php-src/NEWS:1.1247.2.573 --- php-src/NEWS:1.1247.2.572 Fri Feb 20 16:09:08 2004 +++ php-src/NEWS Sun Feb 22 15:07:16 2004 @@ -12,6 +12,7 @@ 16 Feb 2004, Version 4.3.5RC3 - Fixed zero bytes memory allocation when no extra ini files are found in the --with-config-file-scan-dir specified directory. (Eric Colinet, Derick) +- Fixed bug #27354 (Modulus operator crashes PHP). (Derick) - Fixed bug #27235 (Interbase NUMERIC x.0 field returns empty string on 0). (Ard) - Fixed bug #27196 (Missing content_length initialization in apache 2 sapis). http://cvs.php.net/diff.php/Zend/zend_operators.c?r1=1.129.2.4&r2=1.129.2.5&ty=u Index: Zend/zend_operators.c diff -u Zend/zend_operators.c:1.129.2.4 Zend/zend_operators.c:1.129.2.5 --- Zend/zend_operators.c:1.129.2.4 Sat Dec 13 14:29:40 2003 +++ Zend/zend_operators.c Sun Feb 22 15:07:17 2004 @@ -786,6 +786,11 @@ return FAILURE; /* modulus by zero */ } + if (abs(op2->value.lval) == 1) { + ZVAL_LONG(result, 0); + return SUCCESS; + } + result->type = IS_LONG; result->value.lval = op1->value.lval % op2->value.lval; return SUCCESS; http://cvs.php.net/co.php/php-src/tests/lang/bug27354.phpt?r=1.1&p=1 Index: php-src/tests/lang/bug27354.phpt +++ php-src/tests/lang/bug27354.phpt --TEST-- Bug #27354 (Modulus operator crashes PHP) --FILE-- <?php var_dump(-2147483647 % -1); var_dump(-2147483649 % -1); var_dump(-2147483648 % -1); var_dump(-2147483648 % -2); ?> --EXPECT-- int(0) int(0) int(0) int(0) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php