Skip to content

guard oversized blob length in callbackRetBlob#1405

Merged
mattn merged 1 commit into
mattn:masterfrom
dxbjavid:oversize-blob-result-guard
Jun 6, 2026
Merged

guard oversized blob length in callbackRetBlob#1405
mattn merged 1 commit into
mattn:masterfrom
dxbjavid:oversize-blob-result-guard

Conversation

@dxbjavid

@dxbjavid dxbjavid commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

callbackRetBlob forwards a custom function's []byte return through C.int(len(bs)) to sqlite3_result_blob, but the sqlite3 C API takes the byte count as a signed int. On 64-bit a return value over 2 GiB narrows to a negative length, and since the docs say a negative length is only defined for text, sqlite3VdbeMemSetStr runs the blob terminator scan off the end of the Go buffer, which has no NUL terminator (OOB read). I noticed it while reading the result paths after the earlier bind/result length fixes. Same guard as ResultBlob/ResultText: reject with sqlite3_result_error_toobig when it would not fit.

@codecov-commenter

codecov-commenter commented Jun 5, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.45%. Comparing base (18cdded) to head (5f1e21d).
⚠️ Report is 93 commits behind head on master.

Files with missing lines Patch % Lines
callback.go 0.00% 3 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1405      +/-   ##
==========================================
+ Coverage   47.16%   51.45%   +4.28%     
==========================================
  Files          12       13       +1     
  Lines        1533     1862     +329     
==========================================
+ Hits          723      958     +235     
- Misses        669      745      +76     
- Partials      141      159      +18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mattn mattn merged commit c63653b into mattn:master Jun 6, 2026
11 checks passed
@mattn

mattn commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Thank you

@dxbjavid

dxbjavid commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge. Looking forward to contributing more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants