diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2004-02-15 17:22:57 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2004-02-15 17:22:57 +0000 |
| commit | b7329c845698a59eb456648f0b48ad78011e36a8 (patch) | |
| tree | b909b9ecdd3a434224c9452174059523d7ba6be4 /ext/gmp | |
| parent | c3a57206cc3ce176befd94865bd078783b9c11b3 (diff) | |
| download | php-git-b7329c845698a59eb456648f0b48ad78011e36a8.tar.gz | |
Fixed bug #27258 (moved FPE check to correct location).
Fixed several possible FPE.
Diffstat (limited to 'ext/gmp')
| -rw-r--r-- | ext/gmp/gmp.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 1096b1f8e6..0825358693 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -312,6 +312,11 @@ static inline void gmp_zval_binary_ui_op_ex(zval *return_value, zval **a_arg, zv FETCH_GMP_ZVAL(gmpnum_b, b_arg); } + convert_to_long_ex(b_arg); + if (!Z_LVAL_PP(b_arg)) { + RETURN_FALSE; + } + INIT_GMP_NUM(gmpnum_result); if (use_ui && gmp_ui_op) { @@ -353,6 +358,11 @@ static inline void gmp_zval_binary_ui_op2_ex(zval *return_value, zval **a_arg, z FETCH_GMP_ZVAL(gmpnum_b, b_arg); } + convert_to_long_ex(b_arg); + if (!Z_LVAL_PP(b_arg)) { + RETURN_FALSE; + } + INIT_GMP_NUM(gmpnum_result1); INIT_GMP_NUM(gmpnum_result2); @@ -825,11 +835,6 @@ ZEND_FUNCTION(gmp_powm) WRONG_PARAM_COUNT; } - convert_to_long_ex(mod_arg); - if (!Z_LVAL_PP(mod_arg)) { - RETURN_FALSE; - } - FETCH_GMP_ZVAL(gmpnum_base, base_arg); if (Z_TYPE_PP(exp_arg) == IS_LONG && Z_LVAL_PP(exp_arg) >= 0) { @@ -839,6 +844,11 @@ ZEND_FUNCTION(gmp_powm) } FETCH_GMP_ZVAL(gmpnum_mod, mod_arg); + convert_to_long_ex(mod_arg); + if (!Z_LVAL_PP(mod_arg)) { + RETURN_FALSE; + } + INIT_GMP_NUM(gmpnum_result); if (use_ui) { mpz_powm_ui(*gmpnum_result, *gmpnum_base, (unsigned long)Z_LVAL_PP(exp_arg), *gmpnum_mod); |
