Skip to Content.
Sympa Menu

freetds - freetds 0.50 segmentation violation

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: garrick.trowsdale AT telus.com
  • To: freetds
  • Subject: freetds 0.50 segmentation violation
  • Date: Thu, 13 Apr 2000 18:14:54


Summary
-------

Our system is vanilla Red Hat 6.1. We have compiled freeTDS 0.50
under /usr/local/freetds, and have compiled php 3.0.15 standalone CGI
with --with-sybase=/usr/localfreetds to facilitate debugging.

The interfaces file is configured for a MS SQL 7.0 server on WinNT.

Our SELECT queries succeed and return the correct results; however,
our INSERT, and DELETE queries succeed but generate a segmentation
fault in the dbnumcols() function, which attempts to dereference
a null pointer.

We would like to use this software if this issue can be addressed;
I can provide further details as required. Thank you.

garrick.trowsdale AT telus.com

Details
-------

Build freeTDS 0.50 in standard location:

# cd /usr/local
# gzip -d < /tmp/freetds-0.50.tgz | tar -xpf -
# find freetds -exec chown root:root {} \;
# cd freetds
# ./configure --with-tdsver=7.0
# make
# cd src
# make install

Build PHP 3.0.15 as standalone CGI with sybase support:

# rpm -i /tmp/php-3.0.15-2.src.rpm
# cd /usr/src/redhat/SOURCES
# gzip -d < php*gz | tar -xpf -
# find php*15 -exec chown root:root {} \;
# cd php-3.0.15
# ./configure --with-sybase=/usr/local/freetds
# make
# make install

Create /usr/local/freetds/interfaces file:

mssql
query tcp ether mssql 1433
master tcp ether mssql 1433

Test

$ php < select.php3
X-Powered-By: PHP/3.0.15
Content-type: text/html

sybase_connect(mssql, id, pw) success
sybase_select_db(test) success
sybase_query(select * from data) success
sybase_close() success

$ php < insert.php3
X-Powered-By: PHP/3.0.15
Content-type: text/html

sybase_connect(mssql, id, pw) success
sybase_select_db(test) success
Segmentation fault (core dumped)

$ php < select.php3
X-Powered-By: PHP/3.0.15
Content-type: text/html

sybase_connect(mssql, id, pw) success
sybase_select_db(test) success
sybase_query(select * from data) success

row 0: column 0 = 7 column 1 = free column 2 = tds

sybase_close() success

$ php < delete.php3
X-Powered-By: PHP/3.0.15
Content-type: text/html

sybase_connect(mssql, id, pw) success
sybase_select_db(test) success
Segmentation fault (core dumped)

$ php < select.php3
X-Powered-By: PHP/3.0.15
Content-type: text/html

sybase_connect(mssql, id, pw) success
sybase_select_db(test) success
sybase_query(select * from data) success
sybase_close() success

Run gdb

$ gdb php
(gdb) break dbnumcols
Breakpoint 1 at 0x804bb00
(gdb) run < insert.php3
Starting program: /usr/local/bin/php < insert.php3
Breakpoint 1 at 0x40059106: file dblib.c, line 596.
X-Powered-By: PHP/3.0.15
Content-type: text/html

sybase_connect(mssql, id, pw) success
sybase_select_db(test) success

Breakpoint 1, dbnumcols (dbproc=0x80d8238) at dblib.c:596
596 tds = (TDSSOCKET *) dbproc->tds_socket;
(gdb) list 591,599
591 int dbnumcols(DBPROCESS *dbproc)
592 {
593 TDSRESULTINFO *resinfo;
594 TDSSOCKET *tds;
595
596 tds = (TDSSOCKET *) dbproc->tds_socket;
597 resinfo = tds->res_info;
598 return resinfo->num_cols;
599 }
(gdb) print *(dbproc->tds_socket)
$1 = {s = 5, in_buf = 0x80dc500 "ý\020", out_buf = 0x80d92f0 "",
in_buf_max = 408, in_pos = 9, out_pos = 8, in_len = 9, out_len = 0,
out_flag = 1 '\001', last_packet = 1 '\001', parent = 0x80d8238,
res_info = 0x0, comp_info = 0x0, msg_info = 0x80db2f8, major_version =
7,
minor_version = 0,
capabilities = "\001\a\003m\177ÿÿÿþ\002\a\000\000\nh\000\000",
broken_dates = 0 '\000', state = 2 '\002', rows_affected = 1}
(gdb) print (dbproc-_>tds_socket)->res_info
$2 = (TDSRESULTINFO *) 0x0
(gdb)
$3 = (TDSRESULTINFO *) 0x0
(gdb) cont
Continuing.

Program received signal SIGSEGV, Segmentation fault.
dbnumcols (dbproc=0x80d8238) at dblib.c:598
598 return resinfo->num_cols;




Archive powered by MHonArc 2.6.24.

Top of Page