Bug 831941 - ODBC driver segfault accessing null value from DB2 database
ODBC driver segfault accessing null value from DB2 database
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: unixODBC (Show other bugs)
x86_64 Linux
unspecified Severity medium
: rc
: ---
Assigned To: Jan Staněk
Depends On:
Blocks: 782183 947775 1002711
  Show dependency treegraph
Reported: 2012-06-14 02:46 EDT by Siddharth
Modified: 2014-02-02 17:11 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-10-06 21:43:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
php-test-code (469 bytes, application/x-php)
2012-06-14 03:01 EDT, Siddharth
no flags Details

  None (edit)
Description Siddharth 2012-06-14 02:46:24 EDT
Description of problem:
In php with ODBC driver tries to access null value from DB2 database getting segfault.  

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Client release 6.2 (Santiago)

How reproducible:
Always with DB2 database

Steps to Reproduce:
1.Create DB2 database with one value NULL
2.Write code which will fetch values from database in php using unixODBC driver 
3.You will get segfault for NULL value
Actual results:
segfault occurs for NULL value

Expected results:
segfault did not occur

Additional info:
Comment 2 Siddharth 2012-06-14 03:01:39 EDT
Created attachment 591750 [details]
Comment 7 Tom Lane 2012-06-14 09:32:18 EDT
AFAIK we do not ship or support any ODBC driver for DB2.  What driver is being used here?
Comment 8 Siddharth 2012-06-15 03:07:24 EDT
Customer is using unixODBC-2.2.14-11.el6.x86_64 to connect DB2 database.
Comment 9 Tom Lane 2012-06-15 10:43:24 EDT
unixODBC, by itself, is incapable of connecting to any database.  It needs a driver module for the particular database type, and we do not ship one for DB2.
So, again, what are they using?
Comment 10 Siddharth 2012-06-15 14:07:59 EDT
 Sorry I did not know the concept of driver module. 
 In my case PHP-ODBC-MySQL I installaed unixODBC driver and add driver entry to /etc/odbc.ini. 

 >  DRIVER=/usr/lib64/libodbcmyS.so

 So this might be a module to connect database.

 Correct me if I am wrong.
Comment 11 Tom Lane 2012-06-15 14:59:58 EDT
(In reply to comment #10)
>  >  DRIVER=/usr/lib64/libodbcmyS.so

Did that actually work?  Because libodbcmyS.so is the GUI setup library associated with the mysql driver, not the mysql driver itself.  The driver entry ought to be something like /usr/lib64/libmyodbc3_r.so.

In any case, the mysql driver wouldn't work with DB2, unless DB2 is exactly emulating mysql's connection protocol which seems highly unlikely.  So I'm still wondering what the customer is using.

The bottom line here is that I suspect they are using some third-party driver that hasn't been built to be compatible with unixODBC 2.2.14.  There's been some unfortunate instability in the ABI for unixODBC on 64-bit platforms, and if they are using a driver that was built against, say, RHEL5's unixODBC 2.2.11, this type of failure is not surprising at all.
Comment 15 Siddharth 2012-06-18 02:24:48 EDT
Hi Tom,

You were right. From comment #13 it looks like cu might be using some third party libraries to connect DB2 database.
$ cat /etc/odbcinst.ini
Description = DB2 Driver
Driver = /home/db2admin/sqllib/lib32/libdb2.so
Driver64 = /home/db2admin/sqllib/lib64/libdb2.so
Comment 18 RHEL Product and Program Management 2012-09-07 01:26:35 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 20 Andrius Benokraitis 2013-10-06 21:43:15 EDT
This Bugzilla has been reviewed by Red Hat and is not planned on being addressed in Red Hat Enterprise Linux 6, and will be closed. If this bug is critical to production systems, please contact your Red Hat support representative and provide sufficient business justification.

Note You need to log in before you can comment on or make changes to this bug.