|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7632 Segmentation fault upon call to sybase_connect()
Submitted: 2000-11-03 18:50 UTC Modified: 2000-11-07 12:49 UTC
From: serge at panix dot com Assigned:
Status: Closed Package: Sybase (dblib) related
PHP Version: 4.0.3pl1 OS: Solaris 8
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.
Block user comment
Status: Assign to:
Bug Type:
From: serge at panix dot com
New email:
PHP Version: OS:


 [2000-11-03 18:50 UTC] serge at panix dot com

  Host: Sun SparcServer 20 w/128Mb RAM, one CPU
  O/S: Solaris 8
  GCC: 2.95.2
  GDB: 5.0
  PHP: 4.0.3pl1
  PHP Config Args: now lost after a few changes (sorry), but definetely had these:
    --with-sybase=<path to sybase> --with-xml --enable-track-vars


The following PHP script:

        global $s_connection;

        $s_connection = sybase_connect ( "SYBSRV", "user", "password" )
                or die("Could not make SYBASE connection");

        echo "<b>Connected</b>";


invoked as

        /usr/local/bin/php <path to script>/test.php

always resulted in a "Segmentation fault (core dumped)."  GDB stack trace showed the following:

(gdb) bt
#0  0xef132b9c in strlen () from /usr/lib/
#1  0xef547ae8 in dbsetlname () from /usr/local/app/sybase/lib/
#2  0x8838c in php_sybase_do_connect (ht=3, return_value=0x145d58,
    this_ptr=0x0, return_value_used=1, persistent=0) at php_sybase_db.c:354
#3  0x888c8 in php_if_sybase_connect (ht=3, return_value=0x145d58,
    this_ptr=0x0, return_value_used=1) at php_sybase_db.c:512
#4  0xd3038 in execute ()
#5  0xa1fe4 in zend_execute_scripts (type=8, file_count=3) at zend.c:717
#6  0x26f70 in php_execute_script (primary_file=0xeffffb88) at main.c:1200
#7  0x24ebc in main (argc=2, argv=0xeffffc14) at cgi_main.c:715

Stepping through ext/sybase/php_sybase_db.c:php_sybase_do_connect() with gdb showed that the segmentation fault occured at line 354

353:        if (charset) {
354:                DBSETLCHARSET(sybase.login,charset);
355:        }

and was caused by the uninitialized `charset' which contained an out-of-range address.  Changing the declaration of charset at line 257 from

        char *user,*passwd,*host,*charset;


        char *user,*passwd,*host,*charset=(char *)0;

and recompililng php seemed to alleviate the problem.

Thanks for looking into this,

P.S. php_sybase_db.c's ident was
  /* $Id: php_sybase_db.c,v 1.4 2000/09/03 17:43:09 derick Exp $ */


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-07 12:49 UTC]
Thanks for your report. This has actually been fixed in CVS
for quite some time.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 01 05:03:40 2023 UTC