summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-04-18 20:53:21 +0000
committerAntony Dovgal <tony2001@php.net>2007-04-18 20:53:21 +0000
commitc6a784fe36466729fc00d49c46c8e85ab2350e91 (patch)
tree90efe7fbcce640bc7c97b7f8b388506b9fd50aa8 /ext
parent93ca92457cf8ba8ee86508c3748b57ea021409cd (diff)
downloadphp-git-c6a784fe36466729fc00d49c46c8e85ab2350e91.tar.gz
same for gmp_scan*()
Diffstat (limited to 'ext')
-rw-r--r--ext/gmp/gmp.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 68ce034547..7f386e6997 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -1580,6 +1580,11 @@ ZEND_FUNCTION(gmp_scan0)
FETCH_GMP_ZVAL(gmpnum_a, a_arg);
convert_to_long_ex(start_arg);
+ if (Z_LVAL_PP(start_arg) < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Starting index must be greater than or equal to zero");
+ RETURN_FALSE;
+ }
+
RETURN_LONG(mpz_scan0(*gmpnum_a, Z_LVAL_PP(start_arg)));
}
/* }}} */
@@ -1597,6 +1602,11 @@ ZEND_FUNCTION(gmp_scan1)
FETCH_GMP_ZVAL(gmpnum_a, a_arg);
convert_to_long_ex(start_arg);
+
+ if (Z_LVAL_PP(start_arg) < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Starting index must be greater than or equal to zero");
+ RETURN_FALSE;
+ }
RETURN_LONG(mpz_scan1(*gmpnum_a, Z_LVAL_PP(start_arg)));
}