tony2001                Mon Oct 10 06:41:30 2005 EDT

  Modified files:              (Branch: PHP_4_4)
    /php-src/ext/oci8   oci8.c 
  Log:
  fix #33383 (crash when retrieving empty LOBs)
  
  
http://cvs.php.net/diff.php/php-src/ext/oci8/oci8.c?r1=1.183.2.18.2.1&r2=1.183.2.18.2.2&ty=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.183.2.18.2.1 
php-src/ext/oci8/oci8.c:1.183.2.18.2.2
--- php-src/ext/oci8/oci8.c:1.183.2.18.2.1      Mon Jun 13 05:37:57 2005
+++ php-src/ext/oci8/oci8.c     Mon Oct 10 06:41:24 2005
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: oci8.c,v 1.183.2.18.2.1 2005/06/13 09:37:57 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.183.2.18.2.2 2005/10/10 10:41:24 tony2001 Exp $ */
 
 /* TODO list:
  *
@@ -641,7 +641,7 @@
 
        php_info_print_table_start();
        php_info_print_table_row(2, "OCI8 Support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.183.2.18.2.1 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.183.2.18.2.2 $");
 #ifndef PHP_WIN32
        php_info_print_table_row(2, "Oracle Version", PHP_OCI8_VERSION );
        php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR );
@@ -1285,7 +1285,12 @@
                        if (oci_loadlob(statement->conn,descr,&buffer,&loblen)) 
{
                                ZVAL_FALSE(value);
                        } else {
-                               ZVAL_STRINGL(value,buffer,loblen,0);
+                               if (loblen > 0) {
+                                       ZVAL_STRINGL(value,buffer,loblen,0);
+                               }
+                               else {
+                                       ZVAL_EMPTY_STRING(value);
+                               }
                        } 
                } else { 
                        /* return the locator */
@@ -1912,6 +1917,10 @@
                return -1;
        }
 
+       if (readlen == 0) {
+               return 0;
+       }
+       
        buf = emalloc(readlen + 1);
 
        while (readlen > 0) { /* thies loop should not be entered on readlen == 
0 */
@@ -2527,7 +2536,7 @@
                        /* breakthru to open */
                }
        }
-       
+
        server = calloc(1,sizeof(oci_server));
 
        server->persistent = persistent;
@@ -3286,7 +3295,12 @@
                }
 
                if (!oci_loadlob(descr->conn,descr,&buffer,&loblen)) {
-                       RETURN_STRINGL(buffer,loblen,0);
+                       if (loblen > 0) {
+                               RETURN_STRINGL(buffer,loblen,0);
+                       }
+                       else {
+                               RETURN_EMPTY_STRING();
+                       }
                }
        }
 

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

Reply via email to