You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using pickled/unpickled sqlite3.Row results in segfault rather than exception #66174
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=<Date2014-08-06.14:57:36.397>created_at=<Date2014-07-14.00:01:29.138>labels= ['library', 'type-crash']
title='Using pickled/unpickled sqlite3.Row results in segfault rather than exception'updated_at=<Date2014-08-06.14:57:36.396>user='https://bugs.python.org/Elizacat'
Pickling, unpickling, then using an sqlite3.Row object results in a segfault on at least Python 3.3.5, 3.4.0, and 3.4.1. I have attached a test case and a backtrace below.
I know you're not supposed to pickle sqlite3.Row objects, as the given test case below results in an exception to the effect that sqlite3.Row objects cannot be pickled in Python 2.7. I don't think a segfault is the desired behaviour, however...
Activity
Elizacat commentedon Jul 14, 2014
Pickling, unpickling, then using an sqlite3.Row object results in a segfault on at least Python 3.3.5, 3.4.0, and 3.4.1. I have attached a test case and a backtrace below.
I know you're not supposed to pickle sqlite3.Row objects, as the given test case below results in an exception to the effect that sqlite3.Row objects cannot be pickled in Python 2.7. I don't think a segfault is the desired behaviour, however...
Elizacat commentedon Jul 14, 2014
The backtrace of the crash, if it helps
PCManticore commentedon Jul 14, 2014
Hi, thanks for the report. Here's a patch which implements __setstate__ and __getstate__ for Row objects.
serhiy-storchaka commentedon Jul 14, 2014
The issue is not in pickling/unpickling, but in sqlite3.Row.__new__ which creates object in invalid state. Simple example:
PCManticore commentedon Jul 14, 2014
Using your example, I can't make it to crash using the tip, nor with Python 3.4.
PCManticore commentedon Jul 14, 2014
Nevermind, I didn't see the len call.
serhiy-storchaka commentedon Jul 14, 2014
Here is a patch which fixes crash.
PCManticore commentedon Jul 14, 2014
It doesn't crash anymore with your patch, but the pickle.load fails:
serhiy-storchaka commentedon Jul 14, 2014
For pickling open other issue.
PCManticore commentedon Jul 14, 2014
Ups, I accidentally removed the patch review stage, sorry for that.
python-dev commentedon Aug 6, 2014
New changeset c46ad743bcb4 by Serhiy Storchaka in branch '2.7':
Issue bpo-21975: Fixed crash when using uninitialized sqlite3.Row (in particular
http://hg.python.org/cpython/rev/c46ad743bcb4
New changeset c1ca1c4c131b by Serhiy Storchaka in branch '3.4':
Issue bpo-21975: Fixed crash when using uninitialized sqlite3.Row (in particular
http://hg.python.org/cpython/rev/c1ca1c4c131b
New changeset 9244ed41057a by Serhiy Storchaka in branch 'default':
Issue bpo-21975: Fixed crash when using uninitialized sqlite3.Row (in particular
http://hg.python.org/cpython/rev/9244ed41057a