Skip to content
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

[sqlite3] raise MemoryError if sqlite3_open_v2() returns SQLITE_NOMEM #89744

Closed
erlend-aasland opened this issue Oct 22, 2021 · 5 comments
Closed
Assignees
Labels
3.9 only security fixes 3.10 only security fixes 3.11 bug and security fixes extension-modules C modules in the Modules dir topic-sqlite3 type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@erlend-aasland
Copy link
Contributor

BPO 45581
Nosy @ambv, @serhiy-storchaka, @erlend-aasland
PRs
  • bpo-45581: Raise MemoryError in sqlite3.connect if SQLite signals memory error #29171
  • [3.10] bpo-45581: Raise MemoryError in sqlite3.connect if SQLite signals memory error (GH-29171) #29323
  • [3.9] bpo-45581: Raise MemoryError in sqlite3.connect if SQLite signals memory error (GH-29171) #29324
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/erlend-aasland'
    closed_at = <Date 2021-10-29.21:03:05.280>
    created_at = <Date 2021-10-22.19:42:51.788>
    labels = ['extension-modules', '3.10', '3.9', 'type-crash', '3.11']
    title = '[sqlite3] raise MemoryError if sqlite3_open_v2() returns SQLITE_NOMEM'
    updated_at = <Date 2021-10-29.21:03:05.280>
    user = 'https://github.com/erlend-aasland'

    bugs.python.org fields:

    activity = <Date 2021-10-29.21:03:05.280>
    actor = 'lukasz.langa'
    assignee = 'erlendaasland'
    closed = True
    closed_date = <Date 2021-10-29.21:03:05.280>
    closer = 'lukasz.langa'
    components = ['Extension Modules']
    creation = <Date 2021-10-22.19:42:51.788>
    creator = 'erlendaasland'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45581
    keywords = ['patch']
    message_count = 5.0
    messages = ['404818', '405336', '405344', '405346', '405347']
    nosy_count = 3.0
    nosy_names = ['lukasz.langa', 'serhiy.storchaka', 'erlendaasland']
    pr_nums = ['29171', '29323', '29324']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue45581'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @erlend-aasland
    Copy link
    Contributor Author

    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:

    @erlend-aasland erlend-aasland added 3.9 only security fixes 3.10 only security fixes 3.11 bug and security fixes labels Oct 22, 2021
    @erlend-aasland erlend-aasland self-assigned this Oct 22, 2021
    @erlend-aasland erlend-aasland added extension-modules C modules in the Modules dir 3.9 only security fixes 3.10 only security fixes 3.11 bug and security fixes labels Oct 22, 2021
    @erlend-aasland erlend-aasland self-assigned this Oct 22, 2021
    @erlend-aasland erlend-aasland added the extension-modules C modules in the Modules dir label Oct 22, 2021
    @ambv
    Copy link
    Contributor

    ambv commented Oct 29, 2021

    New changeset e2e62b3 by Erlend Egeberg Aasland in branch 'main':
    bpo-45581: Raise MemoryError in sqlite3.connect if SQLite signals memory error (GH-29171)
    e2e62b3

    @ambv
    Copy link
    Contributor

    ambv commented Oct 29, 2021

    New changeset 7e2c0a1 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)
    7e2c0a1

    @ambv
    Copy link
    Contributor

    ambv commented Oct 29, 2021

    New changeset ed807bf 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)
    ed807bf

    @ambv
    Copy link
    Contributor

    ambv commented Oct 29, 2021

    Thanks, Erlend! ✨ 🍰 ✨

    @ambv ambv closed this as completed Oct 29, 2021
    @ambv ambv added the type-crash A hard crash of the interpreter, possibly with a core dump label Oct 29, 2021
    @ambv ambv closed this as completed Oct 29, 2021
    @ambv ambv added the type-crash A hard crash of the interpreter, possibly with a core dump label Oct 29, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 bug and security fixes extension-modules C modules in the Modules dir topic-sqlite3 type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants