Message-ID: From: "jarvis24young (@jarvis24young)" To: "postgresql-interfaces/psqlodbc" Date: Fri, 08 May 2026 10:22:51 +0000 Subject: Re: [postgresql-interfaces/psqlodbc] PR #182: Reject invalid SQLPutData lengths In-Reply-To: References: List-Id: X-GitHub-Author-Login: jarvis24young X-GitHub-Comment-Id: 4405659469 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 182 X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/pull/182#issuecomment-4405659469 Content-Type: text/plain; charset=utf-8 Updated the patch based on the review feedback. Changes made: - Removed the newly added statement error enums and `Statement_sqlstate[]` entries. - Reused existing statement diagnostics instead: - invalid negative `SQLPutData()` length now uses `STMT_INVALID_ARGUMENT_NO` (`HY024`) - appending after a NULL/default put-data indicator now uses `STMT_SEQUENCE_ERROR` (`HY010`) - Added first-call handling for `SQL_DEFAULT_PARAM` so it follows the same early-exit path as `SQL_NULL_DATA` and does not fall through to allocation/copy logic with a negative length. - Moved the negative `EXEC_used` guard before the large-object / non-large-object branch split, so both paths are protected consistently. - Added a second regression case for the append-after-`SQL_NULL_DATA` path. I also updated the PR description to reflect the reused diagnostics and re-ran the WSL regression test: ```text ODBCSYSINI=. ODBCINSTINI=./odbcinst.ini ODBCINI=./odbc.ini ./exe/dataatexecution-test connected Result set: 2 3 Parameter Status Fetching result sets for array bound (2 results expected) 1: Result set: 4 2: Result set: 5 Invalid SQLPutData length rejected SQLPutData append after null rejected disconnecting ```