diff options
| author | Leigh <leight@gmail.com> | 2014-09-24 07:56:46 +0100 |
|---|---|---|
| committer | Leigh <leight@gmail.com> | 2014-09-24 07:56:46 +0100 |
| commit | 3e9a31748d50d1b96e8ca82b2399811f8c73a035 (patch) | |
| tree | b84782a8d6619df2693b1f0a0176b2a434ebb5f1 /ext/gmp/gmp.c | |
| parent | acd7fcf55f81955e4837c750a5e45f83d3c55ba2 (diff) | |
| download | php-git-3e9a31748d50d1b96e8ca82b2399811f8c73a035.tar.gz | |
Make sure min < max
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(); |
