Skip to content

[PDO] Bound-check column index in getColumnMeta() - #23654

Open
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/pdo-getcolumnmeta-bounds-84
Open

[PDO] Bound-check column index in getColumnMeta()#23654
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/pdo-getcolumnmeta-bounds-84

Conversation

@iliaal

@iliaal iliaal commented Sep 10, 2026

Copy link
Copy Markdown
Member

PDOStatement::getColumnMeta() indexed columns as soon as the driver hook succeeded, without checking that columns had been described or that the index was in range, so a driver that reports success unconditionally (pdo_odbc) segfaulted on an unexecuted statement. Both cases now raise ValueError, matching the fetch paths. Drivers that report failure themselves still return false.

getColumnMeta() indexed stmt->columns[colno] as soon as the driver
get_column_meta hook reported success, without verifying that columns
had been described or that colno was below column_count, so a driver
returning unconditional success made an unexecuted statement segfault
and an oversized index read out of bounds. Reject both cases with
ValueError like the fetch paths do. Sibling audit: all other
stmt->columns[] sites are inside describe_columns() loops or
bound-checked paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant