]> 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)
ext/bcmath/bcmath.c
ext/bcmath/tests/bug60377.phpt [new file with mode: 0644]

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