You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PDOStatement::getColumnMeta() reads out of bounds for out-of-range column index (pdo_firebird) #25006
PDOStatement::getColumnMeta() (ext/pdo/pdo_stmt.c) only checks colno < 0 before calling the driver; the colno >= column_count check comes after the dispatch. pdo_firebird_stmt_get_column_meta() (ext/pdo_firebird/firebird_statement.c ~L332) does &S->out_sqlda.sqlvar[colno] with no bound check, so the driver reads out of bounds first. pdo_sqlite, pdo_mysql and pdo_pgsql check the upper bound themselves.
array(4) { ... } // colno 0
PDOException: SQLSTATE[07009]: invalid column index // colno 2..1024, raised only after the OOB read
<access violation, exit code 0xC0000005> // colno 1000000
But I expected this output instead: the same invalid column index error for every out-of-range index, decided before the driver indexes sqlvar[].
Suggested fix: add if (colno < 0 || colno >= stmt->column_count) return FAILURE; in the Firebird driver (or move the upper-bound check before the dispatch in pdo_stmt.c). No existing pdo_firebird test calls getColumnMeta().
Activity
ext/pdo_firebird: Fix phpGH-25006 getColumnMeta() bounds check
ext/pdo_firebird: Fix getColumnMeta() bounds check