Skip to content

Commit a1900c6

Browse files
committed
Finish reverting gmp_pow overflow check
1 parent 7b9b832 commit a1900c6

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

ext/gmp/gmp.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,15 +1142,11 @@ ZEND_FUNCTION(gmp_pow)
11421142
RETURN_THROWS();
11431143
}
11441144

1145-
double powmax = log((double)ZEND_LONG_MAX);
1146-
1145+
mpz_ptr gmpnum_base;
1146+
FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base, 1);
11471147
INIT_GMP_RETVAL(gmpnum_result);
1148-
zend_ulong gmpnum = mpz_get_ui(gmpnum_base);
1149-
if ((log(gmpnum) * exp) > powmax) {
1150-
zend_value_error("base and exponent overflow");
1151-
RETURN_THROWS();
1152-
}
11531148
mpz_pow_ui(gmpnum_result, gmpnum_base, exp);
1149+
FREE_GMP_TEMP(temp_base);
11541150
}
11551151
/* }}} */
11561152

0 commit comments

Comments
 (0)