]> granicus.if.org Git - php/commitdiff
MFH
authorAntony Dovgal <tony2001@php.net>
Wed, 18 Apr 2007 20:36:54 +0000 (20:36 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 18 Apr 2007 20:36:54 +0000 (20:36 +0000)
ext/gmp/gmp.c

index 43edc53d9f0b464c64de77975a46c476bdac28bb..f71ab753ef32e56a17253ffa08c00afb25461cae 100644 (file)
@@ -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);
 }