]> granicus.if.org Git - php/commitdiff
- Fixed bug #60337 bcscale related crashed on 64bits platforms
authorMateusz Kocielski <shm@php.net>
Sat, 19 Nov 2011 12:46:43 +0000 (12:46 +0000)
committerMateusz Kocielski <shm@php.net>
Sat, 19 Nov 2011 12:46:43 +0000 (12:46 +0000)
NEWS
ext/bcmath/bcmath.c
ext/bcmath/tests/bug60377.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 86840851bde5949783a198c0d38a9c27564bc468..657d4f6b5ee5f4cc820f63c935aa37b000551b14 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,8 @@ PHP                                                                        NEWS
   . 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:
index f42d3363b3a99c38705da5d8fa3106f57665e356..bd9d6608a3db929bf53519688bbfbb5a8abc726c 100644 (file)
@@ -560,7 +560,7 @@ PHP_FUNCTION(bcscale)
                return;
        }
 
-       BCG(bc_precision) = (new_scale < 0) ? 0 : new_scale;
+       BCG(bc_precision) = ((int)new_scale < 0) ? 0 : new_scale;
 
        RETURN_TRUE;
 }
diff --git a/ext/bcmath/tests/bug60377.phpt b/ext/bcmath/tests/bug60377.phpt
new file mode 100644 (file)
index 0000000..7c42002
--- /dev/null
@@ -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