php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41688 mssql_connect() Segmentation fault (11)
Submitted: 2007-06-14 14:03 UTC Modified: 2007-06-22 01:00 UTC
From: gdegoulet at sdv dot fr Assigned:
Status: No Feedback Package: MSSQL related
PHP Version: 5.2.3 OS: Linux 2.6.10 #3 S
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gdegoulet at sdv dot fr
New email:
PHP Version: OS:

 

 [2007-06-14 14:03 UTC] gdegoulet at sdv dot fr
Description:
------------
cat a.php

<?php
$db_name="azerty";
$db_user="azerty";
$db_pass="azerty";
$db_host="azerty.sdv.fr";

$link = mssql_connect($db_host, $db_user, $db_pass) or die('Could not connect: ' . mssql_get_last_message());
mssql_close($link);
?>


Reproduce code:
---------------
php 5.2.3 / freetds-0.62.4
Configure Command =>  './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-config-file-path=/etc' '--enable-safe-mode' '--enable-memory-limit' '--with-xml' '--with-zlib' '--enable-inline-optimization' '--with-curl' '--with-mysql=/usr' '--with-freetype-dir=/usr' '--with-jpeg-dir' '--with-png-dir' '--with-gd' '--enable-gd-native-ttf' '--with-sybase=/usr'


[root@traduix php-5.2.3]# gdb /usr/local/bin/php
GNU gdb Red Hat Linux (6.0post-0.20040223.19rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run ./a.php
Starting program: /usr/local/bin/php ./a.php
Error while mapping shared library sections:
: Success.
Error while reading shared library symbols:
: No such file or directory.
[Thread debugging using libthread_db enabled]
[New Thread -1214368352 (LWP 14909)]
Error while reading shared library symbols:
: No such file or directory.
Error while reading shared library symbols:
: No such file or directory.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1214368352 (LWP 14909)]
0x0824c627 in zend_inline_hash_func (arKey=0xb7fe3000 <Address 0xb7fe3000 out of bounds>, nKeyLength=3073856464) at zend_hash.h:260
260			hash = ((hash << 5) + hash) + *arKey++;
(gdb) where
#0  0x0824c627 in zend_inline_hash_func (arKey=0xb7fe3000 <Address 0xb7fe3000 out of bounds>, nKeyLength=3073856464) at zend_hash.h:260
#1  0x0824bab7 in zend_hash_find (ht=0x839ab20, arKey=0xb79ad0b8 "sybase_azerty.sdv.fr_azerty_azerty__", nKeyLength=3080368920, pData=0x8f26c2a1) at /usr/local/src/php-5.2.3/Zend/zend_hash.c:870
#2  0x08202da9 in php_sybase_do_connect (ht=-1893285215, return_value=0xb79ad0a0, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1, persistent=0) at /usr/local/src/php-5.2.3/ext/sybase/php_sybase_db.c:495
#3  0x082039cc in zif_sybase_connect (ht=3, return_value=0xb79ad0a0, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1) at /usr/local/src/php-5.2.3/ext/sybase/php_sybase_db.c:570
#4  0x0825b49e in zend_do_fcall_common_helper_SPEC (execute_data=0xbfffd640) at zend_vm_execute.h:200
#5  0x0825ad6d in execute (op_array=0xb79ac874) at zend_vm_execute.h:92
#6  0x08244415 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/src/php-5.2.3/Zend/zend.c:1134
#7  0x08211255 in php_execute_script (primary_file=0xbffff9c0) at /usr/local/src/php-5.2.3/main/main.c:1794
#8  0x0829e07a in main (argc=2, argv=0xbffffa94) at /usr/local/src/php-5.2.3/sapi/cli/php_cli.c:1138
(gdb) quit





Expected result:
----------------
simply open - close database connection or die

Actual result:
--------------
[root@traduix php-5.2.3]# php a.php 
Segmentation fault


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-14 16:26 UTC] fmk@php.net
A couple of things to try.

1) Compile php using --with-mssql instead of --with-sybase. This will give you all the mssql_functions and you will be using the mssql extension and not the sybase extension.

2) Get the latest version of freeTDS.
 [2007-06-22 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-07-31 13:54 UTC] roberto dot valsania at mail dot wind dot it
I got the same stacktrace using php 5.2.2 compiled with --with-sybase and triing to connect a Sybase database .

PHP Version :
PHP 5.2.2 (cli) (built: Jul 31 2007 15:03:43) (DEBUG)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
[root@dba-iv1 ~]#     

This is the simple code :

<?php
$db = sybase_connect("xx","aa","ss") ;
?>

And this is the stack :
gdb) backtrace
#0  0x082af6b0 in ?? ()
#1  0x082b1fb1 in zend_hash_find ()
#2  0x08227636 in ?? ()
#3  0x08227a5b in zif_sybase_connect ()
#4  0x082cc83d in ?? ()
#5  0x082d2a4a in ?? ()
#6  0x082cc32a in execute ()
#7  0x082a4665 in zend_execute_scripts ()
#8  0x08245d57 in php_execute_script ()
#9  0x08327ddf in main ()
(gdb)
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 09 06:03:45 2022 UTC