Fix rare multi-packet string corruption#3505
Merged
cheenamalhotra merged 4 commits intodotnet:mainfrom Jul 24, 2025
Merged
Conversation
Contributor
Author
|
@dotnet/sqlclientdevteam can I get a CI run please |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3505 +/- ##
==========================================
- Coverage 64.78% 58.95% -5.83%
==========================================
Files 276 270 -6
Lines 62192 61865 -327
==========================================
- Hits 40289 36472 -3817
- Misses 21903 25393 +3490
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Show resolved
Hide resolved
mdaigle
reviewed
Jul 23, 2025
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs
Show resolved
Hide resolved
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
paulmedynski
approved these changes
Jul 24, 2025
mdaigle
approved these changes
Jul 24, 2025
cheenamalhotra
approved these changes
Jul 24, 2025
cheenamalhotra
pushed a commit
that referenced
this pull request
Jul 24, 2025
* add test and simplify code to fix problems * review feedback * review feedback * review feedback
paulmedynski
pushed a commit
that referenced
this pull request
Jul 25, 2025
samsharma2700
added a commit
that referenced
this pull request
Aug 5, 2025
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.
Fixes #3504
The sample data provided in the original issue by @Suchiman showed me that there were multiple problems happening when reading long strings. The data in the new test would not successfully complete the first iteration without asserting and would throw an exception on the second iteration. The lengths of the values and their combinations over multiple packets are important, even the column name lengths contribute to the offsets so they have not been changed. The data itself is randomised from a production sample.
The changes add in asserts to ensure that if we are expecting to continue that we have a stored buffer to continue with. There was a case where no buffer was present at a continue point causing the tail end of a multi-packet string to be returned to the user successfully causing an incorrect data read.
The conditions in which buffers and lengths are stored in the snapshot are relaxed. This brings the code more into line with the more relaxed handling of replay to continue that was added in previous commits. Overall I'm happier with this lessening of complexity.