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

lobject (conn) can segfault with bad parameter #187

Closed
psycoteam opened this issue Nov 27, 2013 · 5 comments
Closed

lobject (conn) can segfault with bad parameter #187

psycoteam opened this issue Nov 27, 2013 · 5 comments

Comments

@psycoteam
Copy link

psycoteam commented Nov 27, 2013

Originally submitted by: Voicu Hodrea

attempting to create an lobject but giving a wrong parameter (something which is not a connection object) will segfault python

@dvarrazzo
Copy link
Member

dvarrazzo commented Nov 27, 2013

Thank you for the report. Args should be parsed using O! instead of O. See cursor_init() for an example.

@psycoteam
Copy link
Author

psycoteam commented Nov 27, 2013

Originally submitted by: Voicu

Hmm, I tested what happens when doing psycopg2.extensions.cursor(<not a conn object>) and the result is weird - the cursor object is created and it lets you do operations but fails in unexpected ways - the query fails with the exception "cursor already closed" which is not very descriptive IMHO.

@dvarrazzo
Copy link
Member

dvarrazzo commented Nov 27, 2013

Really? It doesn't seem so:

>>> cur = psycopg2.extensions.cursor([])
TypeError: argument 1 must be psycopg2._psycopg.connection, not list

@dvarrazzo
Copy link
Member

dvarrazzo commented Nov 27, 2013

Fixed:

dvarrazzo/psycopg@7e9e11e

@psycoteam
Copy link
Author

psycoteam commented Nov 27, 2013

Originally submitted by: Voicu

Hmm, I now see I'm on an earlier version actually (2.4.5)

@@@ python

import psycopg2.extensions as ex
ex.cursor([])
<cursor object at 0x00000000026B9B40; closed: 0>

Thanks for the fix, I should probably update...

joulez pushed a commit to joulez/psycopg2 that referenced this issue Nov 13, 2014
gencer pushed a commit to gencer/psycopg2 that referenced this issue Aug 22, 2016
gencer pushed a commit to gencer/psycopg2 that referenced this issue Aug 22, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants