We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf0c2a8 commit 972f582Copy full SHA for 972f582
ext/gmp/gmp.c
@@ -1290,6 +1290,7 @@ ZEND_FUNCTION(gmp_pow)
1290
INIT_GMP_RETVAL(gmpnum_result);
1291
gmpnum = mpz_get_ui(gmpnum_base);
1292
if ((log10(gmpnum) * exp) > (double)ULONG_MAX) {
1293
+ FREE_GMP_TEMP(temp_base);
1294
zend_value_error("base and exponent overflow");
1295
RETURN_THROWS();
1296
}
ext/gmp/tests/gmp_pow_fpe.phpt
@@ -0,0 +1,22 @@
1
+--TEST--
2
+gmp_pow() floating point exception
3
+--EXTENSIONS--
4
+gmp
5
+--FILE--
6
+<?php
7
+$g = gmp_init(256);
8
+
9
+try {
10
+ gmp_pow($g, PHP_INT_MAX);
11
+} catch (\ValueError $e) {
12
+ echo $e->getMessage() . PHP_EOL;
13
+}
14
15
+ gmp_pow(256, PHP_INT_MAX);
16
17
+ echo $e->getMessage();
18
19
+?>
20
+--EXPECT--
21
+base and exponent overflow
22
0 commit comments