tony2001 Mon Oct 10 06:42:12 2005 EDT Modified files: (Branch: PHP_5_0) /php-src/ext/oci8 oci8.c Log: MF44: fix #33383 (crash when retrieving empty LOBs) http://cvs.php.net/diff.php/php-src/ext/oci8/oci8.c?r1=1.257.2.9&r2=1.257.2.10&ty=u Index: php-src/ext/oci8/oci8.c diff -u php-src/ext/oci8/oci8.c:1.257.2.9 php-src/ext/oci8/oci8.c:1.257.2.10 --- php-src/ext/oci8/oci8.c:1.257.2.9 Tue Oct 4 14:15:23 2005 +++ php-src/ext/oci8/oci8.c Mon Oct 10 06:42:11 2005 @@ -22,7 +22,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8.c,v 1.257.2.9 2005/10/04 18:15:23 tony2001 Exp $ */ +/* $Id: oci8.c,v 1.257.2.10 2005/10/10 10:42:11 tony2001 Exp $ */ /* TODO list: * @@ -786,7 +786,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "OCI8 Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.257.2.9 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.257.2.10 $"); sprintf(buf, "%ld", num_persistent); php_info_print_table_row(2, "Active Persistent Links", buf); @@ -1489,7 +1489,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 */ @@ -2248,6 +2253,10 @@ return -1; } + if (readlen == 0) { + return 0; + } + buf = emalloc(readlen + 1); while (readlen > 0) { /* thies loop should not be entered on readlen == 0 */ @@ -2351,6 +2360,10 @@ *len = 0; return -1; } + + if (loblen == 0) { + return 0; + } /* check if we're in LOB's borders */ if ((mydescr->lob_current_position + *len) > loblen) { @@ -4016,7 +4029,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(); + } } else { RETURN_FALSE; } @@ -4050,7 +4068,12 @@ loblen = Z_LVAL_PP(len); if (oci_readlob(descr->conn,descr,&buffer,&loblen) == 0) { - RETURN_STRINGL(buffer,loblen,0); + if (loblen > 0) { + RETURN_STRINGL(buffer,loblen,0); + } + else { + RETURN_EMPTY_STRING(); + } } else { RETURN_FALSE; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php