Bug 205718 - memory corruption on php odbc_exec call to mysql
memory corruption on php odbc_exec call to mysql
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: mysql (Show other bugs)
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Tom Lane
Kevin Baker
Depends On:
  Show dependency treegraph
Reported: 2006-09-08 03:31 EDT by Alan
Modified: 2014-12-01 18:08 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-06-20 12:13:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Alan 2006-09-08 03:31:47 EDT
Description of problem:

Making an odbc call from within a php script to a mysql database under RHEL
fails with a crash.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.  Create an ODBC dsn to connect to a mysql database like:
Description     = MySQL
Driver          = MySQL
Server          = localhost
Database        = test
Port            = 3306
Socket          =
Option          =
Stmt            =

2.  Create a php script to query that database using odbc calls like:
odbc_exec($connect,"use test");

Actual results:

*** glibc detected *** malloc(): memory corruption: 0x08882200 ***

Expected results:

connect to the database succesfully

Additional info:

I have tried to trace this problem down on the MySQL and PHP bug trackers and it
is hard to know where the issue really lies.  I have tried many different
version combinations of php, mysql and the odbc-connector.  ONE COMBINATION DOES
WORK:  using mysql-connector-odbc-3.51.12-1 and mysql-4.1.12-3.RHEL4.1
as soon as you upgrade to mysql-4.1.20-1 the same exact setup starts to fail. 
Issue persists on newest MySQL rpms from mysql.org and php5.1  

***this NEVER works with RHEL out of the box***

there are a couple of other people out there who have seen similar things.  bug
171064 seems to be a special case of this problem.  There is a much fuller
description using the centos4 rpms for mysql5 at:

Upgrading to mysql-odbc-connector does change the bug from a memory corruption
bug to a segmentation fault.  nevertheless with Update 4 upgrading mysql to
4.1.20 there is no way to get an odbc connection under php.
Comment 1 Tom Lane 2006-09-08 09:53:40 EDT
I know nearly zip about php.  Would you mind providing a complete test case,
that is a php script that triggers the problem and an example of how to run it?
Comment 2 Alan 2006-09-09 06:33:48 EDT
ok, a more complete test case.  On a fresh RHEL4 update 4 install:
1.  start mysqld (service mysqld start).  this assume you haven't created any
tables or set any passwords.  your "test" database will be there, but myodbc
won't even make it that far.  
2.  edit /etc/odbc.ini to include the entry from (1) above
2a.  you /etc/odbcinst.ini file should have an entry that looks like:
Description     = MySQL Connector 2.5
Driver          = libmyodbc.so
Setup           = libodbcmyS.so
UsageCount      = 1
FileUsage       = 1
3.  open a text editor, copy and paste the following, name it test.php:
$connect = odbc_connect("localtest", "root", "");
print "connected\n";
$result = odbc_exec($connect, "use test;") or die ("Query Failed.");
print "$result\n";
4.  execute it (php ./test.php)

you'll see the output:
*** glibc detected *** malloc(): memory corruption: 0x0854d638 ***

or something similar
Comment 3 Tom Lane 2007-09-05 16:35:58 EDT
Hmm ... it suddenly occurs to me that maybe this is the same problem diagnosed and fixed in bug 
#185343, which would make it MyODBC's fault not mysql's.
Comment 4 Alan 2007-09-06 06:14:45 EDT
might be MyODBC's fault, but since it works in some configurations and not
others while leaving mysql-connector-odbc constant it at least seems to be an
interoperability issue.

on a further note, this bug seems to have disappeared in RHEL5.  still present
in 4.5 though
Comment 6 Jiri Pallich 2012-06-20 12:13:36 EDT
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. 
Please See https://access.redhat.com/support/policy/updates/errata/

If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.

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