File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1290,6 +1290,7 @@ ZEND_FUNCTION(gmp_pow)
1290
1290
INIT_GMP_RETVAL (gmpnum_result );
1291
1291
gmpnum = mpz_get_ui (gmpnum_base );
1292
1292
if ((log10 (gmpnum ) * exp ) > (double )ULONG_MAX ) {
1293
+ FREE_GMP_TEMP (temp_base );
1293
1294
zend_value_error ("base and exponent overflow" );
1294
1295
RETURN_THROWS ();
1295
1296
}
Original file line number Diff line number Diff line change
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
+ try {
15
+ gmp_pow (256 , PHP_INT_MAX );
16
+ } catch (\ValueError $ e ) {
17
+ echo $ e ->getMessage ();
18
+ }
19
+ ?>
20
+ --EXPECT--
21
+ base and exponent overflow
22
+ base and exponent overflow
You can’t perform that action at this time.
0 commit comments