Repository navigation
sqlite crashes with converters mutating cursor #80254
Description
Activity
It's somewhat similar to bpo-10811, but for converter function:
In [197]: import sqlite3 as sqlite
...: con = sqlite.connect(':memory:', detect_types=sqlite.PARSE_COLNAMES)
...: cur = con.cursor()
...: sqlite.converters['CURSOR_INIT'] = lambda x: cur.__init__(con)
...:
...: cur.execute('create table test(x foo)')
...: cur.execute('insert into test(x) values (?)', ('foo',))
...: cur.execute('select x as "x [CURSOR_INIT]", x from test')
...:
[1] 25718 segmentation fault python manage.py shellSimilar to bpo-10811, proposed patch raises ProgrammingError instead of crashing.
- addedextension-modulesC modules in the Modules dirC modules in the Modules dirtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
on Feb 22, 2019 Er, a little bit too fast there. There is still a crash, but it is of course postponed bco. bpo-44976. New reproducer:
import sqlite3 as sqlite con = sqlite.connect(':memory:', detect_types=sqlite.PARSE_COLNAMES) cur = con.cursor() sqlite.converters['CURSOR_INIT'] = lambda x: cur.__init__(con)
cur.execute('create table test(x foo)')
cur.execute('insert into test(x) values (?)', ('foo',))
for row in cur.execute('select x as "x [CURSOR_INIT]", x from test'):
print(row)- added a commit that references this issue
on May 3, 2022 List of backport PRs:
- 3.10 backport: [3.10] gh-80254: Disallow recursive usage of cursors in
sqlite3converters #92274 - 3.9 backport: [3.9] gh-80254: Disallow recursive usage of cursors in
sqlite3converters #92278 - 3.8 backport: [3.8] gh-80254: Disallow recursive usage of cursors in sqlite3 converters #92333
- 3.7 backport: [3.7] gh-80254: Disallow recursive usage of cursors in sqlite3 converters #92334
- 3.10 backport: [3.10] gh-80254: Disallow recursive usage of cursors in
- added a commit that references this issue
on May 16, 2022 - added a commit that references this issue
on May 23, 2022
sqlite3converters #29054Note: 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:
bugs.python.org fields: