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

sqlite's create_function() raises exception on unhashable callback, but creates function #78233

Closed
sir-sigurd mannequin opened this issue Jul 5, 2018 · 5 comments
Closed
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@sir-sigurd
Copy link
Mannequin

sir-sigurd mannequin commented Jul 5, 2018

BPO 34052
Nosy @serhiy-storchaka, @sir-sigurd
PRs
  • bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. #8113
  • [3.7] bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). #10946
  • [3.6] bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). (GH-10946) #10952
  • [2.7] bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). (GH-10946) #10955
  • 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/serhiy-storchaka'
    closed_at = <Date 2018-12-05.22:22:06.276>
    created_at = <Date 2018-07-05.10:34:47.456>
    labels = ['extension-modules', '3.8', 'type-bug', '3.7']
    title = "sqlite's create_function() raises exception on unhashable callback, but creates function"
    updated_at = <Date 2018-12-05.22:22:06.276>
    user = 'https://github.com/sir-sigurd'

    bugs.python.org fields:

    activity = <Date 2018-12-05.22:22:06.276>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2018-12-05.22:22:06.276>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2018-07-05.10:34:47.456>
    creator = 'sir-sigurd'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34052
    keywords = ['patch']
    message_count = 5.0
    messages = ['321094', '331138', '331166', '331180', '331184']
    nosy_count = 3.0
    nosy_names = ['ghaering', 'serhiy.storchaka', 'sir-sigurd']
    pr_nums = ['8113', '10946', '10952', '10955']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue34052'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @sir-sigurd
    Copy link
    Mannequin Author

    sir-sigurd mannequin commented Jul 5, 2018

    In [1]: import sqlite3

    In [2]: con = sqlite3.connect(':memory:')

    In [3]: con.execute('SELECT f()')
    ---------------------------------------------------------------------------

    OperationalError                          Traceback (most recent call last)
    <ipython-input-3-e3bab2096896> in <module>()
    ----> 1 con.execute('SELECT f()')

    OperationalError: no such function: f

    In [4]: con.create_function('f', 0, [])
    ---------------------------------------------------------------------------

    TypeError                                 Traceback (most recent call last)
    <ipython-input-4-452e7d2028ac> in <module>()
    ----> 1 con.create_function('f', 0, [])

    TypeError: unhashable type: 'list'

    In [5]: con.execute('SELECT f()')
    ---------------------------------------------------------------------------

    OperationalError                          Traceback (most recent call last)
    <ipython-input-5-e3bab2096896> in <module>()
    ----> 1 con.execute('SELECT f()')

    OperationalError: user-defined function raised exception

    It seems that something like this cause segmentation fault, but I can't reproduce it.
    Some other similar sqlite functions also affected. They can be easily modified to accept unhashable objects, but probably it should be done in another issue.

    @sir-sigurd sir-sigurd mannequin added 3.8 only security fixes extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Jul 5, 2018
    @serhiy-storchaka serhiy-storchaka added the 3.7 (EOL) end of life label Jul 5, 2018
    @serhiy-storchaka serhiy-storchaka self-assigned this Jul 5, 2018
    @serhiy-storchaka
    Copy link
    Member

    New changeset 5b25f1d by Serhiy Storchaka (Sergey Fedoseev) in branch 'master':
    bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113)
    5b25f1d

    @serhiy-storchaka
    Copy link
    Member

    New changeset 1de91a0 by Serhiy Storchaka in branch '3.7':
    bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). (GH-10946)
    1de91a0

    @serhiy-storchaka
    Copy link
    Member

    New changeset fdf5050 by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6':
    bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). (GH-10946) (GH-10952)
    fdf5050

    @serhiy-storchaka
    Copy link
    Member

    New changeset fff8fab by Serhiy Storchaka in branch '2.7':
    [2.7] bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). (GH-10946) (GH-10955)
    fff8fab

    @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.7 (EOL) end of life 3.8 only security fixes extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant