tony2001                Wed Apr 18 20:36:48 2007 UTC

  Modified files:              
    /php-src/ext/gmp    gmp.c 
  Log:
  do not allow negative byte index
  tests will follow soon
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.59&r2=1.60&diff_format=u
Index: php-src/ext/gmp/gmp.c
diff -u php-src/ext/gmp/gmp.c:1.59 php-src/ext/gmp/gmp.c:1.60
--- php-src/ext/gmp/gmp.c:1.59  Fri Jan 12 12:31:31 2007
+++ php-src/ext/gmp/gmp.c       Wed Apr 18 20:36:47 2007
@@ -1492,6 +1492,11 @@
                        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 {
@@ -1516,6 +1521,11 @@
 
        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);
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to