From b141fb1afb2919e54f3d4f795797726cfe43245c Mon Sep 17 00:00:00 2001 From: Mateusz Kocielski Date: Sat, 19 Nov 2011 12:46:43 +0000 Subject: [PATCH] - Fixed bug #60337 bcscale related crashed on 64bits platforms --- NEWS | 2 ++ ext/bcmath/bcmath.c | 2 +- ext/bcmath/tests/bug60377.phpt | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 ext/bcmath/tests/bug60377.phpt diff --git a/NEWS b/NEWS index 86840851bd..657d4f6b5e 100644 --- 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: diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index f42d3363b3..bd9d6608a3 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -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 index 0000000000..7c42002917 --- /dev/null +++ b/ext/bcmath/tests/bug60377.phpt @@ -0,0 +1,13 @@ +--TEST-- +bcscale related problem on 64bits platforms +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +ALIVE -- 2.50.1