Skip to content

ext/pdo_firebird: Fix GH-25006 getColumnMeta() bounds check - #25016

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

iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/gh-25006-getcolumnmeta-bounds

Conversation

@iliaal

@iliaal iliaal commented Oct 28, 2026

Copy link
Copy Markdown
Member

pdo_firebird_stmt_get_column_meta() indexed out_sqlda.sqlvar[colno] before PDO checked colno against column_count. column_count is the number of XSQLVAR slots allocated with XSQLDA_LENGTH(). A near index read past that allocation and the core then raised SQLSTATE 07009. A far index faulted. The hook now returns an empty array without reading sqlvar when colno is outside that range, and the existing core check raises 07009. describe and get_col are already limited by their callers. param_hook already rejects paramno >= sqld. Returning FAILURE from this hook would return false instead, because the statement error is cleared before the driver runs.

Fixes #25006

pdo_firebird_stmt_get_column_meta() indexed out_sqlda.sqlvar before the
core rejected an out-of-range column. column_count is the number of
XSQLVAR slots from XSQLDA_LENGTH(). The hook now returns success without
reading sqlvar, and the existing check raises SQLSTATE 07009. describe
and get_col stay inside their callers' column loops. param_hook already
rejects paramno >= sqld. Returning FAILURE here would yield false,
because the statement error is cleared before the hook runs.

Fixes phpGH-25006
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