Bug #7781 SQLGeInfo segmentation violation when getting db name
Submitted: 10 Jan 2005 19:34 Modified: 13 Jan 2005 11:46
Reporter: Radovan Chytracek Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51 OS:Linux (Linux 2.4)
Assigned to: CPU Architecture:Any

[10 Jan 2005 19:34] Radovan Chytracek
Description:
When running the following code it segfaults with the latest MyODBC 3.51.10 on Linux 2.4 with unixODBC 2.2.6 and built against MySQL 4.1.8a client with GCC 3.2.3. Fails against MySQL server 4.0.22 or 4.1.7.

How to repeat:
  SQLRETURN rc;
  SQLCHAR      InfoValuePtr[4096];
  SQLSMALLINT  BufferLength    = 4096;
  SQLSMALLINT  StringLengthPtr = 0;

  rc = SQLGetInfo( con, SQL_DATABASE_NAME,InfoValuePtr, BufferLength, &StringLengthPtr );
[10 Jan 2005 19:35] Radovan Chytracek
GDB back trace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 6399)]
0x42080c63 in strlen () from /lib/i686/libc.so.6
(gdb) bt
#0  0x42080c63 in strlen () from /lib/i686/libc.so.6
#1  0x404ba389 in SQLGetInfo () from /afs/cern.ch/sw/lcg/external/myodbc/3.51.10_mysql.4.1.8a/rh73_gcc323/lib/libmyodbc3.so
#2  0x40308892 in SQLGetInfo (connection_handle=0x8063ed8, info_type=4095, info_value=0xbfff8690, buffer_length=4096, string_length=0xbfff868c) at SQLGetInfo.c:514
#3  0x080535cd in main () at /home/build/pool/proto/POOL_2_0_0/src/ODBCAccess/tests/InspectODBC/inspectODBC.cpp:301
#4  0x42017589 in __libc_start_main () from /lib/i686/libc.so.6
[13 Jan 2005 11:46] Aleksey Kishkin
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.mysql.com/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Additional info:

I attached testcase that I wrote to test this bug report. Tested on slackware 10 with kernel 2.4 and 2.6, against mysql 4.1.8 and latest 4.0, every time got  output of testcase:

 bash-2.05b$ ./a.out
Connected !
database test

as expected.

Please check my testcase if I catch properly your idea, and run it on your computer.
If you have any other ideas please let us know.
[13 Jan 2005 11:47] Aleksey Kishkin
a testcase that I used

Attachment: odbc.c (text/x-csrc), 2.64 KiB.

[16 Oct 2007 11:20] Susanne Ebrecht
Hi,

I can't reproduce this error using MyODBC 3.51.21.

Please, try again with our newest MyODBC driver version 3.51.21 or 5.1 and let us know, if the error still occurs.

Regards,

Susanne
[16 Oct 2007 11:22] Susanne Ebrecht
I forgot, the version number of this bug was wrong. I fixed it, this bug is for MyODBC 3.51.