From: Antony Dovgal Date: Wed, 18 Apr 2007 20:53:28 +0000 (+0000) Subject: MFH X-Git-Tag: php-5.2.2RC2~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8aa441b9b82a74883572982154ede15fcdab448e;p=php MFH --- diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index f71ab753ef..b8e036ee62 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -1572,6 +1572,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))); } /* }}} */ @@ -1589,6 +1594,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))); }