wmjie / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

The column type SQL_WLONGVARCHAR is unsupported and will cause a segfault when returned. #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When an unsupported column type is encountered the value of the last column is 
used again, but it will be decrefed or the unowned copy will added to the 
results tuple.

In my case the type was SQL_WLONGVARCHAR and the previous value was an 
SQL_INTEGER and the incorrect reference counting was corrupting the PyLong pool 
allocator.

The copyright assignment for for this patch is is being submitted.

Original issue reported on code.google.com by jason.mi...@hostway.com on 22 Mar 2012 at 8:22

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks Michalski for reporting this bug and singing contribution agreement.

We appreciate you for you patch but we want to know the steps to reproduce this 
issue.

Original comment by rahul.pr...@in.ibm.com on 29 Mar 2012 at 11:03

GoogleCodeExporter commented 9 years ago
db2 > describe table BOOK;

Column                         Type      Type
name                           schema    name               Length   Scale Nulls
------------------------------ --------- ------------------ -------- ----- 
------
ID                             SYSIBM    INTEGER                   4     0 No   

TITLE                          SYSIBM    LONG VARGRAPHIC       16350     0 No   

AUTHOR_ID                      SYSIBM    INTEGER                   4     0 No   

  3 record(s) selected.

db2 > select ID, substr(TITLE, 1, 10) TITLE, AUTHOR_ID from BOOK;

ID          TITLE                AUTHOR_ID  
----------- -------------------- -----------
          1 Test                 1

  1 record(s) selected.

import ibm_db_dbi
conn = ibm_db_dbi.pconnect('devdb', '', '')
c = conn.cursor()

sql = 'select * from JASONM_TEST.BOOK;'

print sql
c.execute(sql)
print c.fetchall()

print sql
c.execute(sql)
print c.fetchall()

$ python crash2.py 
select * from JASONM_TEST.BOOK;
[(1L, 1L, 1L)]
select * from JASONM_TEST.BOOK;
Segmentation fault

Original comment by jason.mi...@hostway.com on 29 Mar 2012 at 3:12

GoogleCodeExporter commented 9 years ago
I have created a patch with the help of your patch, you can find the modified 
ibm_db.c in attachment in issue #100.

Please let me know how it works for you.

Original comment by rahul.pr...@in.ibm.com on 3 Apr 2012 at 12:48

GoogleCodeExporter commented 9 years ago
It is working well, thanks.

Original comment by jason.mi...@hostway.com on 3 Apr 2012 at 1:59

GoogleCodeExporter commented 9 years ago
Released with ibm_db-1.0.6

Original comment by rahul.pr...@in.ibm.com on 25 May 2012 at 6:53