tony2001 Mon Oct 10 06:44:42 2005 EDT
Modified files: (Branch: PHP_5_1)
/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.269.2.2&r2=1.269.2.3&ty=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.269.2.2 php-src/ext/oci8/oci8.c:1.269.2.3
--- php-src/ext/oci8/oci8.c:1.269.2.2 Tue Oct 4 14:15:18 2005
+++ php-src/ext/oci8/oci8.c Mon Oct 10 06:44:39 2005
@@ -22,7 +22,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.2 2005/10/04 18:15:18 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.3 2005/10/10 10:44:39 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.269.2.2 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.3 $");
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) {
@@ -4015,7 +4028,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;
}
@@ -4049,7 +4067,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