cvs: ZendEngine2(PHP_5_3) / zend_operators.c

From: Date: Thu, 29 May 2008 11:45:13 +0000
Subject: cvs: ZendEngine2(PHP_5_3) / zend_operators.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6755@lists.php.net to get a copy of this message
mattwil Thu May 29 11:45:13 2008 UTC Modified files: (Branch: PHP_5_3) /ZendEngine2 zend_operators.c Log: MFH: Fixed overflow crash (at least on Windows) in div_function with LONG_MIN / -1 http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.208.2.4.2.23.2.10&r2=1.208.2.4.2.23.2.11&diff_format=u Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.10 ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.11 --- ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.10 Wed Mar 19 12:41:23 2008 +++ ZendEngine2/zend_operators.c Thu May 29 11:45:13 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.10 2008/03/19 12:41:23 tony2001 Exp $ */ +/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.11 2008/05/29 11:45:13 mattwil Exp $ */ #include <ctype.h> @@ -934,6 +934,10 @@ zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; /* division by zero */ + } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN) { + /* Prevent overflow error/crash */ + ZVAL_DOUBLE(result, (double) LONG_MIN / -1); + return SUCCESS; } if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */ ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2));

« previous php.zend-engine.cvs (#6755) next »