diff options
| author | Antony Dovgal <tony2001@php.net> | 2007-04-18 20:36:54 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2007-04-18 20:36:54 +0000 |
| commit | efcb227198fffb560c7d6209516e58d38eb5381c (patch) | |
| tree | 9a4b264324634a497a4aa6209d6033dbd583af23 | |
| parent | b2785c3d4c60c07d72623eba8d325f0b37247ae2 (diff) | |
| download | php-git-efcb227198fffb560c7d6209516e58d38eb5381c.tar.gz | |
MFH
| -rw-r--r-- | ext/gmp/gmp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 43edc53d9f..f71ab753ef 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -1484,6 +1484,11 @@ ZEND_FUNCTION(gmp_setbit) break; } + if (index < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero"); + return; + } + if (set) { mpz_setbit(*gmpnum_a, index); } else { @@ -1508,6 +1513,11 @@ ZEND_FUNCTION(gmp_clrbit) convert_to_long_ex(ind_arg); index = Z_LVAL_PP(ind_arg); + + if (index < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero"); + return; + } mpz_clrbit(*gmpnum_a, index); } |
