File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1350,11 +1350,11 @@ ZEND_FUNCTION(gmp_pow)
13501350 RETURN_THROWS ();
13511351 }
13521352
1353- double powmax = 2000 ;
1353+ double max_bits = 16000 ; // TODO: value is very small, but passed current test suite
13541354
13551355 if (Z_TYPE_P (base_arg ) == IS_LONG && Z_LVAL_P (base_arg ) >= 0 ) {
13561356 INIT_GMP_RETVAL (gmpnum_result );
1357- if ((log (Z_LVAL_P (base_arg )) / log ( 256 ) * exp ) > powmax ) {
1357+ if ((log2 (Z_LVAL_P (base_arg )) * exp ) > max_bits ) {
13581358 zend_value_error ("base and exponent overflow" );
13591359 RETURN_THROWS ();
13601360 }
@@ -1363,7 +1363,7 @@ ZEND_FUNCTION(gmp_pow)
13631363 mpz_ptr gmpnum_base ;
13641364 FETCH_GMP_ZVAL (gmpnum_base , base_arg , temp_base , 1 );
13651365 INIT_GMP_RETVAL (gmpnum_result );
1366- if ((mpz_sizeinbase (gmpnum_base , 16 ) / 2.0 * exp ) > powmax ) {
1366+ if ((mpz_sizeinbase (gmpnum_base , 2 ) * exp ) > max_bits ) {
13671367 FREE_GMP_TEMP (temp_base );
13681368 zend_value_error ("base and exponent overflow" );
13691369 RETURN_THROWS ();
You can’t perform that action at this time.
0 commit comments