[PHP-CVS] com php-src: fix stack overflow in php_intlog10abs(): ext/standard/math.c
Commit:5c87ca2d2770e18c385d4b770123b9b21eeaa053 Author:Nuno Lopes nlop...@php.net Fri, 11 May 2012 12:50:29 -0400 Parents: d0d7340d50f178691c8e436391168cf6cc1fea3e Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5c87ca2d2770e18c385d4b770123b9b21eeaa053 Log: fix stack overflow in php_intlog10abs() bug uncovered by LLVM/clang's new -fbounds-checking switch this patch fixes a crash in ext/standard/tests/math/round_large_exp.phpt Changed paths: M ext/standard/math.c Diff: diff --git a/ext/standard/math.c b/ext/standard/math.c index 302fbda..65187f6 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -37,7 +37,7 @@ static inline int php_intlog10abs(double value) { int result; value = fabs(value); - if (value 1e-8 || value 1e23) { + if (value 1e-8 || value 1e22) { result = (int)floor(log10(value)); } else { static const double values[] = { @@ -46,7 +46,7 @@ static inline int php_intlog10abs(double value) { 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22}; /* Do a binary search with 5 steps */ - result = 16; + result = 15; if (value values[result]) { result -= 8; } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fix stack overflow in php_intlog10abs(): ext/standard/math.c
Commit:8b4b70df56e14be0f7172b5cc5f8da44b3272ac3 Author:Nuno Lopes nlop...@php.net Fri, 11 May 2012 12:50:29 -0400 Parents: 4458f3bcf65e5826f4cfb8ffd00cd3b8161f37bd Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8b4b70df56e14be0f7172b5cc5f8da44b3272ac3 Log: fix stack overflow in php_intlog10abs() bug uncovered by LLVM/clang's new -fbounds-checking switch this patch fixes a crash in ext/standard/tests/math/round_large_exp.phpt Changed paths: M ext/standard/math.c Diff: diff --git a/ext/standard/math.c b/ext/standard/math.c index 302fbda..65187f6 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -37,7 +37,7 @@ static inline int php_intlog10abs(double value) { int result; value = fabs(value); - if (value 1e-8 || value 1e23) { + if (value 1e-8 || value 1e22) { result = (int)floor(log10(value)); } else { static const double values[] = { @@ -46,7 +46,7 @@ static inline int php_intlog10abs(double value) { 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22}; /* Do a binary search with 5 steps */ - result = 16; + result = 15; if (value values[result]) { result -= 8; } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fix stack overflow in php_intlog10abs(): ext/standard/math.c
Commit:950d5ee590214742799836d3d939ee59f641bdf4 Author:Nuno Lopes nlop...@php.net Fri, 11 May 2012 12:50:29 -0400 Parents: 81ba6b14c7b1b934f4d3e2896f861a42b07aa838 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=950d5ee590214742799836d3d939ee59f641bdf4 Log: fix stack overflow in php_intlog10abs() bug uncovered by LLVM/clang's new -fbounds-checking switch this patch fixes a crash in ext/standard/tests/math/round_large_exp.phpt Changed paths: M ext/standard/math.c Diff: diff --git a/ext/standard/math.c b/ext/standard/math.c index 21c730c..749c77c 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -37,7 +37,7 @@ static inline int php_intlog10abs(double value) { int result; value = fabs(value); - if (value 1e-8 || value 1e23) { + if (value 1e-8 || value 1e22) { result = (int)floor(log10(value)); } else { static const double values[] = { @@ -46,7 +46,7 @@ static inline int php_intlog10abs(double value) { 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22}; /* Do a binary search with 5 steps */ - result = 16; + result = 15; if (value values[result]) { result -= 8; } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php