mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
fix #33383 (crash when retrieving empty BLOBs)
This commit is contained in:
parent
2d5f21c2fb
commit
f15f20ffa2
3 changed files with 22 additions and 3 deletions
|
@ -1490,7 +1490,12 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
|
||||||
ZVAL_FALSE(value);
|
ZVAL_FALSE(value);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
if (lob_length > 0) {
|
||||||
ZVAL_STRINGL(value, lob_buffer, lob_length, 0);
|
ZVAL_STRINGL(value, lob_buffer, lob_length, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ZVAL_EMPTY_STRING(value);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -243,8 +243,13 @@ PHP_FUNCTION(oci_lob_load)
|
||||||
if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len TSRMLS_CC)) {
|
if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len TSRMLS_CC)) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
if (buffer_len > 0) {
|
||||||
RETURN_STRINGL(buffer, buffer_len, 0);
|
RETURN_STRINGL(buffer, buffer_len, 0);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
RETURN_EMPTY_STRING();
|
||||||
|
}
|
||||||
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto string oci_lob_read( int length )
|
/* {{{ proto string oci_lob_read( int length )
|
||||||
|
@ -283,8 +288,13 @@ PHP_FUNCTION(oci_lob_read)
|
||||||
if (php_oci_lob_read(descriptor, length, descriptor->lob_current_position, &buffer, &buffer_len TSRMLS_CC)) {
|
if (php_oci_lob_read(descriptor, length, descriptor->lob_current_position, &buffer, &buffer_len TSRMLS_CC)) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
if (buffer_len > 0) {
|
||||||
RETURN_STRINGL(buffer, buffer_len, 0);
|
RETURN_STRINGL(buffer, buffer_len, 0);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
RETURN_EMPTY_STRING();
|
||||||
|
}
|
||||||
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto bool oci_lob_eof()
|
/* {{{ proto bool oci_lob_eof()
|
||||||
|
|
|
@ -161,6 +161,10 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long off
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (length <= 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (offset > length) {
|
if (offset > length) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be less than size of the LOB");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be less than size of the LOB");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue