bind via sqlite3_bind_text64/blob64 to avoid 32-bit length truncation#1403
Merged
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1403 +/- ##
==========================================
+ Coverage 47.16% 51.53% +4.37%
==========================================
Files 12 13 +1
Lines 1533 1859 +326
==========================================
+ Hits 723 958 +235
- Misses 669 742 +73
- Partials 141 159 +18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
|
Thank you |
Contributor
Author
|
Thanks for the review and merge! Appreciated |
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.
reading the bind path I noticed bindText and the blob case in bindValue narrow len through C.int before calling sqlite3_bind_text/blob. on 64-bit a parameter of 2 GiB or more wraps to a negative int32, and sqlite then derives the length via strlen over the go buffer which has no guaranteed nul terminator, so it reads past the end. a 4 GiB value instead truncates to a small positive count and binds the wrong bytes. switching the wrappers to the 64-bit variants keeps the full length so sqlite enforces SQLITE_LIMIT_LENGTH and returns SQLITE_TOOBIG. this mirrors the oversize guard already in ResultBlob/ResultText.