Bug 831941

Summary: ODBC driver segfault accessing null value from DB2 database
Product: Red Hat Enterprise Linux 6 Reporter: Siddharth <swaikar>
Component: unixODBCAssignee: Jan Staněk <jstanek>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3CC: fjaspe, jstanek, praiskup, syeghiay, vgaikwad
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-07 01:43:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 782183, 947775, 1002711    
Attachments:
Description Flags
php-test-code none

Description Siddharth 2012-06-14 06:46:24 UTC
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)
unixODBC-2.2.14-11.el6.x86_64

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 07:01:39 UTC
Created attachment 591750 [details]
php-test-code

Comment 7 Tom Lane 2012-06-14 13:32:18 UTC
AFAIK we do not ship or support any ODBC driver for DB2.  What driver is being used here?

Comment 8 Siddharth 2012-06-15 07:07:24 UTC
Customer is using unixODBC-2.2.14-11.el6.x86_64 to connect DB2 database.

Comment 9 Tom Lane 2012-06-15 14:43:24 UTC
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 18:07:59 UTC
 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 18:59:58 UTC
(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 06:24:48 UTC
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
[DB2]
Description = DB2 Driver
Driver = /home/db2admin/sqllib/lib32/libdb2.so
Driver64 = /home/db2admin/sqllib/lib64/libdb2.so
fileusage=1
dontdlclose=1

Comment 18 RHEL Program Management 2012-09-07 05:26:35 UTC
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-07 01:43:15 UTC
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.