]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6' into PHP-7.0
authorAnatol Belski <ab@php.net>
Wed, 23 Dec 2015 17:24:56 +0000 (18:24 +0100)
committerAnatol Belski <ab@php.net>
Wed, 23 Dec 2015 17:24:56 +0000 (18:24 +0100)
* PHP-5.6:
  Added test for bug #71201
  Bug #71201 round() segfault on 64-bit builds

1  2 
ext/standard/math.c

index 6059f3dd9bb28a7432f8b4dbb9a666343608db8c,e0041731c592e838a0a88e97c52557e540f94436..73face4a9bf66187886d154ae806a28950ffe098
@@@ -390,7 -353,15 +390,15 @@@ PHP_FUNCTION(round
        }
  
        if (ZEND_NUM_ARGS() >= 2) {
-               places = (int) precision;
 -#if SIZEOF_LONG > SIZEOF_INT
++#if SIZEOF_ZEND_LONG > SIZEOF_INT
+               if (precision >= 0) {
+                       places = precision > INT_MAX ? INT_MAX : (int)precision;
+               } else {
+                       places = precision <= INT_MIN ? INT_MIN+1 : (int)precision;
+               }
+ #else
+               places = precision;
+ #endif
        }
        convert_scalar_to_number_ex(value);