Bug 205718 - memory corruption on php odbc_exec call to mysql
Summary: memory corruption on php odbc_exec call to mysql
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: mysql
Version: 4.4
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
: ---
Assignee: Tom Lane
QA Contact: Kevin Baker
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-09-08 07:31 UTC by Alan
Modified: 2014-12-01 23:08 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 16:13:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Alan 2006-09-08 07:31:47 UTC
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):

mysql-4.1.20-1.RHEL4.1
MyODBC-2.50.39-21.RHEL4.1
php-4.3.9-3.15
unixODBC-2.2.11-1.RHEL4.1

How reproducible:

Always

Steps to Reproduce:
1.  Create an ODBC dsn to connect to a mysql database like:
[localtest]
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:
$connect=odbc_connect(localtest,$username,$password);
odbc_exec($connect,"use test");

Actual results:

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

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:
http://bugs.centos.org/view.php?id=1288

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.
-alan

Comment 1 Tom Lane 2006-09-08 13:53:40 UTC
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 10:33:48 UTC
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:
[MySQL]
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:
<?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 ***
Abort

or something similar
-alan

Comment 3 Tom Lane 2007-09-05 20:35:58 UTC
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 10:14:45 UTC
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
-alan

Comment 6 Jiri Pallich 2012-06-20 16:13:36 UTC
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.