1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-18494: PDO OCI segfault in statement GC

This is the same issue that was fixed in 2ae897fff7, but now for OCI.

Closes GH-18495.
This commit is contained in:
Niels Dossche
2025-05-04 19:09:05 +02:00
parent fb3536fd60
commit dcf9d8f812
2 changed files with 12 additions and 2 deletions

3
NEWS
View File

@@ -25,6 +25,9 @@ PHP NEWS
. Fixed bug GH-18417 (Windows SHM reattachment fails when increasing
memory_consumption or jit_buffer_size). (nielsdos)
- PDO_OCI:
. Fixed bug GH-18494 (PDO OCI segfault in statement GC). (nielsdos)
- SPL:
. Fixed bug GH-18421 (Integer overflow with large numbers in LimitIterator).
(nielsdos)

View File

@@ -98,14 +98,21 @@ static int oci_stmt_dtor(pdo_stmt_t *stmt) /* {{{ */
S->einfo.errmsg = NULL;
}
/* TODO: There's php_pdo_stmt_valid_db_obj_handle in PHP-8.5-dev that does these checks. */
bool server_obj_usable = !Z_ISUNDEF(stmt->database_object_handle)
&& IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)])
&& !(OBJ_FLAGS(Z_OBJ(stmt->database_object_handle)) & IS_OBJ_FREE_CALLED);
if (S->cols) {
for (i = 0; i < stmt->column_count; i++) {
if (S->cols[i].data) {
switch (S->cols[i].dtype) {
case SQLT_BLOB:
case SQLT_CLOB:
OCI_TEMPLOB_CLOSE(S->H->env, S->H->svc, S->H->err,
(OCILobLocator *) S->cols[i].data);
if (server_obj_usable) {
OCI_TEMPLOB_CLOSE(S->H->env, S->H->svc, S->H->err,
(OCILobLocator *) S->cols[i].data);
}
OCIDescriptorFree(S->cols[i].data, OCI_DTYPE_LOB);
break;
default: