Skip to content

odbc: check SQLColAttribute return codes in the field info functions - #23601

Open
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:promote/odbc-colattribute-checked
Open

odbc: check SQLColAttribute return codes in the field info functions#23601
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:promote/odbc-colattribute-checked

Conversation

@iliaal

@iliaal iliaal commented Sep 6, 2026

Copy link
Copy Markdown
Member

odbc_column_lengths() and odbc_field_type() ignored the SQLColAttribute return code and returned their output buffer regardless, so a driver that fails the call left odbc_field_len(), odbc_field_scale() and odbc_field_type() reporting uninitialized stack. They now check the code and warn with the driver's own SQLGetDiagRec diagnostic.

odbc_bindcols() gets the one-line zero-init of name for the same reason; it has no way to report an error, since it runs during result setup and returns void. No test: reaching the branch needs a driver that fails SQLColAttribute on a valid column index, and there is no existing php-src harness for injecting that.

odbc_column_lengths() and odbc_field_type() ignored the SQLColAttribute
return code and returned their output buffer regardless, so a driver that
fails the call left odbc_field_len(), odbc_field_scale() and
odbc_field_type() reporting uninitialized stack. Check the code, warn with
the driver's own diagnostic, and return 0 or false instead.

Closes phpGH-23601
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