Skip to content

No NULL check in sqlite connection.c #129346

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

Closed
wooffie opened this issue Jan 27, 2025 · 4 comments
Closed

No NULL check in sqlite connection.c #129346

wooffie opened this issue Jan 27, 2025 · 4 comments
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes topic-sqlite3 type-bug An unexpected behavior, bug, or error

Comments

@wooffie
Copy link
Contributor

wooffie commented Jan 27, 2025

Bug report

Bug description:

aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));

In this case we don'y check it against NULL, and can dereference in next line:

if (*aggregate_instance == NULL) {

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

@wooffie wooffie added the type-bug An unexpected behavior, bug, or error label Jan 27, 2025
@serhiy-storchaka serhiy-storchaka added 3.12 only security fixes topic-sqlite3 3.13 bugs and security fixes 3.14 bugs and security fixes labels Jan 27, 2025
@erlend-aasland
Copy link
Contributor

No, it cannot be NULL. See the SQLite C API docs for more information. We could add an assert.

erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jan 27, 2025
@erlend-aasland erlend-aasland removed type-bug An unexpected behavior, bug, or error 3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes labels Jan 27, 2025
@erlend-aasland
Copy link
Contributor

I removed the bug label. This is not a bug; it is just a missing assert.

@erlend-aasland erlend-aasland added type-bug An unexpected behavior, bug, or error 3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes labels Jan 27, 2025
@erlend-aasland
Copy link
Contributor

Looking more closely at this, I agree with Serhiy it is a bug.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 27, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 27, 2025
@github-project-automation github-project-automation bot moved this from TODO: Bugs to Done in sqlite3 issues Jan 27, 2025
erlend-aasland added a commit that referenced this issue Jan 27, 2025
…xt (GH-129347) (#129373)

(cherry picked from commit 379ab85)

Co-authored-by: Erlend E. Aasland <[email protected]>
erlend-aasland added a commit that referenced this issue Jan 27, 2025
…xt (GH-129347) (#129372)

(cherry picked from commit 379ab85)

Co-authored-by: Erlend E. Aasland <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes topic-sqlite3 type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

3 participants