diff options
Diffstat (limited to 'ext/gmp/gmp.c')
| -rw-r--r-- | ext/gmp/gmp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 301729d563..2a6cc3d3c0 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -1871,6 +1871,13 @@ ZEND_FUNCTION(gmp_random_range) FETCH_GMP_ZVAL(gmpnum_min, min_arg, temp_a); FETCH_GMP_ZVAL(gmpnum_max, max_arg, temp_b); + if (mpz_cmp(gmpnum_min, gmpnum_max) > 0) { + FREE_GMP_TEMP(temp_a); + FREE_GMP_TEMP(temp_b); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The minimum value must be lower than the maximum value"); + return; + } + INIT_GMP_RETVAL(gmpnum_result); gmp_init_random(); |
