Menu

#213 Running this given sql command results in a buffer overflow error and python crashing

open
nobody
None
5
2012-08-24
2012-08-24
Jira Trac
No

Install cubrid with the demodb database and the python driver. You can either use Windows or Linux to see this problem.

The user that encountered the problem is one of our affiliate users and this bug crashes his application.

{code:python}
import CUBRIDdb
conn = CUBRIDdb.connect('CUBRID:localhost:30000:demodb', 'dba', '')
cur = conn.cursor()
cur.execute(SELECT IF( 100.0*(SUM(CASE WHEN `nation_code` = 'AHO' AND `gender` = 'M' THEN 1 ELSE 0 END))/(SUM(CASE WHEN `nation_code` = 'AHO' AND `gender` IS NOT NULL THEN 1 ELSE 0 END)) IS NOT NULL , 100.0*(SUM(CASE WHEN `nation_code` = 'AHO' AND `gender` = 'M' THEN 1 ELSE 0 END))/(SUM(CASE WHEN `nation_code` = 'AHO' AND `gender` IS NOT NULL THEN 1 ELSE 0 END)), 0) FROM `athlete`)
rows = cur.fetchall()
for row in rows:
print row
{code}

I have tested the same sql with the PHP driver and it correctly returns 100. The same result is obtained in csql.

In python it crashes either on Windows or on Linux. I tested on Ubuntu 12.04 after I installed the python driver using easy_install. I have attached the crash message the above code displays.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.