classification
Title: [sqlite3] raise MemoryError if sqlite3_open_v2() returns SQLITE_NOMEM
Type: crash Stage: resolved
Components: Extension Modules Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: erlendaasland Nosy List: erlendaasland, lukasz.langa, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2021-10-22 19:42 by erlendaasland, last changed 2021-10-29 21:03 by lukasz.langa. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29171 merged erlendaasland, 2021-10-22 19:55
PR 29323 merged lukasz.langa, 2021-10-29 20:32
PR 29324 merged lukasz.langa, 2021-10-29 20:33
Messages (5)
msg404818 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-10-22 19:42
Currently, we call _pysqlite_seterror() if sqlite3_open_v2() returns != SQLITE_OK. However, if a memory failure occurs during sqlite3_open_v2(), the database handle is explicitly set to NULL. This _may_ cause _pysqlite_seterror() to segfault, since we pass it a NULL db pointer, because behaviour is undefined if we pass sqlite3_errmsg() a NULL pointer.


See also:
- https://sqlite.org/c3ref/open.html
msg405336 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-10-29 20:22
New changeset e2e62b3808691e15fa44b883270023e42dcad958 by Erlend Egeberg Aasland in branch 'main':
bpo-45581: Raise `MemoryError` in `sqlite3.connect` if SQLite signals memory error (GH-29171)
https://github.com/python/cpython/commit/e2e62b3808691e15fa44b883270023e42dcad958
msg405344 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-10-29 20:54
New changeset 7e2c0a18b41cb906a354776e6ca52af81e39820f by Łukasz Langa in branch '3.10':
[3.10] bpo-45581: Raise `MemoryError` in `sqlite3.connect` if SQLite signals memory error (GH-29171) (GH-29323)
https://github.com/python/cpython/commit/7e2c0a18b41cb906a354776e6ca52af81e39820f
msg405346 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-10-29 21:02
New changeset ed807bf333cdc78b92c9861600acf1a435c52193 by Łukasz Langa in branch '3.9':
[3.9] bpo-45581: Raise `MemoryError` in `sqlite3.connect` if SQLite signals memory error (GH-29171) (GH-29324)
https://github.com/python/cpython/commit/ed807bf333cdc78b92c9861600acf1a435c52193
msg405347 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-10-29 21:03
Thanks, Erlend! ✨ 🍰 ✨
History
Date User Action Args
2021-10-29 21:03:05lukasz.langasetstatus: open -> closed
type: crash
messages: + msg405347

resolution: fixed
stage: patch review -> resolved
2021-10-29 21:02:29lukasz.langasetmessages: + msg405346
2021-10-29 20:54:11lukasz.langasetmessages: + msg405344
2021-10-29 20:33:57lukasz.langasetpull_requests: + pull_request27594
2021-10-29 20:32:20lukasz.langasetpull_requests: + pull_request27593
2021-10-29 20:22:06lukasz.langasetnosy: + lukasz.langa
messages: + msg405336
2021-10-22 19:55:15erlendaaslandsetkeywords: + patch
stage: patch review
pull_requests: + pull_request27444
2021-10-22 19:42:51erlendaaslandcreate