File tree 1 file changed +3
-3
lines changed
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)
1350
1350
RETURN_THROWS ();
1351
1351
}
1352
1352
1353
- double powmax = 2000 ;
1353
+ double max_bits = 16000 ; // TODO: value is very small, but passed current test suite
1354
1354
1355
1355
if (Z_TYPE_P (base_arg ) == IS_LONG && Z_LVAL_P (base_arg ) >= 0 ) {
1356
1356
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 ) {
1358
1358
zend_value_error ("base and exponent overflow" );
1359
1359
RETURN_THROWS ();
1360
1360
}
@@ -1363,7 +1363,7 @@ ZEND_FUNCTION(gmp_pow)
1363
1363
mpz_ptr gmpnum_base ;
1364
1364
FETCH_GMP_ZVAL (gmpnum_base , base_arg , temp_base , 1 );
1365
1365
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 ) {
1367
1367
FREE_GMP_TEMP (temp_base );
1368
1368
zend_value_error ("base and exponent overflow" );
1369
1369
RETURN_THROWS ();
You can’t perform that action at this time.
0 commit comments