com php-src: Remove UB in signed printing macro: Zend/zend_op erators.h

From: Date: Fri, 23 May 2014 11:15:08 +0000
Subject: com php-src: Remove UB in signed printing macro: Zend/zend_op erators.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-78501@lists.php.net to get a copy of this message
Commit: c838f6c5b9a1daf32d24f9acced793d7cb9647da Author: Nikita Popov <nikic@php.net> Fri, 23 May 2014 13:15:08 +0200 Parents: 1d8c499b5152a9e52729ce8e6b2a0feee0192a43 Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c838f6c5b9a1daf32d24f9acced793d7cb9647da Log: Remove UB in signed printing macro Signed->unsigned conversion and unsigned negation are well-defined (unlike signed negation for LONG_MIN.) Changed paths: M Zend/zend_operators.h Diff: diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index f03e05b..d61fbc2 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -979,10 +979,7 @@ static zend_always_inline void fast_is_not_identical_function(zval *result, zval /* buf points to the END of the buffer */ #define _zend_print_signed_to_buf(buf, num, vartype, result) do { \ if (num < 0) { \ - /* this might cause problems when dealing with LONG_MIN - and machines which don't support long long. Works - flawlessly on 32bit x86 */ \ - _zend_print_unsigned_to_buf((buf), -(num), vartype, (result)); \ + _zend_print_unsigned_to_buf((buf), -(vartype)(num), vartype, (result)); \ *--(result) = '-'; \ } else { \ _zend_print_unsigned_to_buf((buf), (num), vartype, (result)); \

« previous php.cvs (#78501) next »