shm                                      Sat, 19 Nov 2011 12:46:43 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=319546

Log:
- Fixed bug #60337 bcscale related crashed on 64bits platforms

Bug: https://bugs.php.net/60337 (Assigned) bcscale related problem on 64bits 
platforms
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/bcmath/bcmath.c
    A   php/php-src/branches/PHP_5_3/ext/bcmath/tests/bug60377.phpt
    U   php/php-src/branches/PHP_5_4/NEWS
    U   php/php-src/branches/PHP_5_4/ext/bcmath/bcmath.c
    A   php/php-src/branches/PHP_5_4/ext/bcmath/tests/bug60377.phpt
    U   php/php-src/trunk/ext/bcmath/bcmath.c
    A   php/php-src/trunk/ext/bcmath/tests/bug60377.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-11-19 12:16:47 UTC (rev 319545)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-11-19 12:46:43 UTC (rev 319546)
@@ -16,6 +16,9 @@
   . Enhance error log when the primary script can't be open. FR #60199. (fat)
   . Added .phar to default authorized extensions. (fat)

+- BCmath:
+  . Fixed bug #60377 (bcscale related crashes on 64bits platforms) (shm)
+
 - EXIF:
   . Fixed bug #60150 (Integer overflow during the parsing of invalid exif
     header). (Stas, flolechaud at gmail dot com)

Modified: php/php-src/branches/PHP_5_3/ext/bcmath/bcmath.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/bcmath/bcmath.c    2011-11-19 12:16:47 UTC 
(rev 319545)
+++ php/php-src/branches/PHP_5_3/ext/bcmath/bcmath.c    2011-11-19 12:46:43 UTC 
(rev 319546)
@@ -560,7 +560,7 @@
                return;
        }

-       BCG(bc_precision) = (new_scale < 0) ? 0 : new_scale;
+       BCG(bc_precision) = ((int)new_scale < 0) ? 0 : new_scale;

        RETURN_TRUE;
 }

Added: php/php-src/branches/PHP_5_3/ext/bcmath/tests/bug60377.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/bcmath/tests/bug60377.phpt                 
        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/bcmath/tests/bug60377.phpt 2011-11-19 
12:46:43 UTC (rev 319546)
@@ -0,0 +1,13 @@
+--TEST--
+bcscale related problem on 64bits platforms
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+$var48 = bcscale(634314234334311);
+$var67 = bcsqrt(false);
+$var414 = bcadd(false,null,10);
+die('ALIVE');
+?>
+--EXPECTF--
+ALIVE

Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS   2011-11-19 12:16:47 UTC (rev 319545)
+++ php/php-src/branches/PHP_5_4/NEWS   2011-11-19 12:46:43 UTC (rev 319546)
@@ -52,6 +52,8 @@
   . Remove EXPERIMENTAL flag. (fat)
   . Added .phar to default authorized extensions. (fat)

+- BCmath:
+  . Fixed bug #60377 (bcscale related crashes on 64bits platforms) (shm)

 11 Nov 2011, PHP 5.4.0 RC1
 - General improvements:

Modified: php/php-src/branches/PHP_5_4/ext/bcmath/bcmath.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/bcmath/bcmath.c    2011-11-19 12:16:47 UTC 
(rev 319545)
+++ php/php-src/branches/PHP_5_4/ext/bcmath/bcmath.c    2011-11-19 12:46:43 UTC 
(rev 319546)
@@ -560,7 +560,7 @@
                return;
        }

-       BCG(bc_precision) = (new_scale < 0) ? 0 : new_scale;
+       BCG(bc_precision) = ((int)new_scale < 0) ? 0 : new_scale;

        RETURN_TRUE;
 }

Added: php/php-src/branches/PHP_5_4/ext/bcmath/tests/bug60377.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/bcmath/tests/bug60377.phpt                 
        (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/bcmath/tests/bug60377.phpt 2011-11-19 
12:46:43 UTC (rev 319546)
@@ -0,0 +1,13 @@
+--TEST--
+bcscale related problem on 64bits platforms
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+$var48 = bcscale(634314234334311);
+$var67 = bcsqrt(false);
+$var414 = bcadd(false,null,10);
+die('ALIVE');
+?>
+--EXPECTF--
+ALIVE

Modified: php/php-src/trunk/ext/bcmath/bcmath.c
===================================================================
--- php/php-src/trunk/ext/bcmath/bcmath.c       2011-11-19 12:16:47 UTC (rev 
319545)
+++ php/php-src/trunk/ext/bcmath/bcmath.c       2011-11-19 12:46:43 UTC (rev 
319546)
@@ -560,7 +560,7 @@
                return;
        }

-       BCG(bc_precision) = (new_scale < 0) ? 0 : new_scale;
+       BCG(bc_precision) = ((int)new_scale < 0) ? 0 : new_scale;

        RETURN_TRUE;
 }

Added: php/php-src/trunk/ext/bcmath/tests/bug60377.phpt
===================================================================
--- php/php-src/trunk/ext/bcmath/tests/bug60377.phpt                            
(rev 0)
+++ php/php-src/trunk/ext/bcmath/tests/bug60377.phpt    2011-11-19 12:46:43 UTC 
(rev 319546)
@@ -0,0 +1,13 @@
+--TEST--
+bcscale related problem on 64bits platforms
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+$var48 = bcscale(634314234334311);
+$var67 = bcsqrt(false);
+$var414 = bcadd(false,null,10);
+die('ALIVE');
+?>
+--EXPECTF--
+ALIVE

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to