Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

lobject (conn) can segfault with bad parameter

#187

Submitted by: Voicu Hodrea

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

Reported by Psycopg website · November 26th, 2013 @ 06:38 PM

State: resolved
Milestone: none
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from new to open

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

    November 27th, 2013 @ 11:17 AM

  2. Voicu
    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.

    November 27th, 2013 @ 11:30 AM

  3. Daniele Varrazzo
    Daniele Varrazzo

    Really? It doesn't seem so:

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

    November 27th, 2013 @ 12:06 PM

  4. Daniele Varrazzo
  5. Voicu
    Voicu

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

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

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

    November 27th, 2013 @ 01:35 PM