Skip to content

bpo-43296: Handle sqlite3_value_blob() errors #24674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 14, 2021

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Feb 28, 2021

  • sqlite3_value_blob() should be called before sqlite3_value_bytes()
  • handle sqlite3_value_blob() out-of-memory errors

https://bugs.python.org/issue43296

@erlend-aasland
Copy link
Contributor Author

@berkerpeksag / @serhiy-storchaka: would one of you mind reviewing this?

Erlend E. Aasland added 5 commits March 10, 2021 14:44
https://sqlite.org/c3ref/value_blob.html:
"As long as the input parameter is correct, these routines can only fail if an
out-of-memory error occurs during a format conversion."
@erlend-aasland
Copy link
Contributor Author

FYI: Rebased onto master to trigger CI again.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Apr 10, 2021
cur_py_value = PyBytes_FromStringAndSize(
sqlite3_value_blob(cur_value), buflen);
case SQLITE_BLOB: {
sqlite3 *db = sqlite3_context_db_handle(context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it may make sense to see what other core devs think about declaring new variables inside case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, there's plenty of other such cases in the code base: grep -A1 -rE "\<case\>.*:.*{" Modules

@berkerpeksag berkerpeksag merged commit 5cb601f into python:master Apr 14, 2021
@erlend-aasland erlend-aasland deleted the bpo-43296/blob branch April 14, 2021 21:09
@erlend-aasland
Copy link
Contributor Author

Thanks for reviewing, @berkerpeksag !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale PR or inactive for long period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants