Repository navigation
FIX: Validate driver-provided fetch sizes - #803
Open
gargsaumya wants to merge 61 commits into
Open
gargsaumya wants to merge 61 commits into
gargsaumya wants to merge 61 commits into
Conversation
…nto saumya/native-fetch-validation
…nto saumya/native-fetch-validation # Conflicts: # mssql_python/pybind/ddbc_bindings.cpp
…nto saumya/native-fetch-validation # Conflicts: # mssql_python/pybind/ddbc_bindings.cpp
Gaurav Sharma (bewithgaurav)
requested changes
Sep 24, 2026
Gaurav Sharma (bewithgaurav)
left a comment
Collaborator
There was a problem hiding this comment.
the driver-provided size validation is well scoped and the normal fetch and arrow paths hold up. I found one suggestion worth incorporating before merge, so requesting changes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Successful zero-row fetches can loop indefinitely, and malformed indicators or the global test hook can cause resource and concurrency problems.
Review effort: Balanced
Findings: 2
Open (4)
What changed in this PR
Adds defensive validation for driver-provided fetch metadata in the native ODBC layer.
Changes:
- Validates row counts, indicators, wide-character lengths, and Arrow bounds.
- Hardens streamed variable-length fetching and buffer growth.
- Adds native regression scenarios and subprocess coverage.
| File | Description |
|---|---|
mssql_python/pybind/ddbc_bindings.cpp |
Implements fetch validation and test hooks. |
mssql_python/pybind/ddbc_bindings.h |
Rejects malformed wide-character lengths. |
tests/test_010_pybind_functions.py |
Tests malformed driver responses and streaming progress. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nto copilot/pr803-rebased
…nto copilot/pr803-rebased
Treat SQL_NO_DATA as normal completion only after a direct LOB fetch has returned payload. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…crosoft/mssql-python into copilot/pr803-rebased
…crosoft/mssql-python into copilot/pr803-rebased
…crosoft/mssql-python into copilot/pr803-rebased
Seed direct and bound fetch indicators with invalid sentinels so omitted driver writes cannot expose empty or stale data. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…crosoft/mssql-python into copilot/pr803-rebased
Seed every direct SQLGetData output with the invalid indicator sentinel before driver calls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…crosoft/mssql-python into copilot/pr803-rebased
Reject unreadable truncation diagnostics, missing variant probe indicators, and SQL_NO_TOTAL for fixed-width columns. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Work Item / Issue Reference
Summary
Stacked on #802 so this review contains only driver-provided fetch validation.