From:             deanb at gbtn dot net
Operating system: Digital Unix 4.0F
PHP version:      4.3.5
PHP Bug Type:     Sybase-ct (ctlib) related
Bug description:  sybase_free_result crashes

Description:
------------
If I use sybase_free_result() in a script, then php crashes.  The exact
same code works fine in php 4.3.4.



./configure  --with-sybase-ct=${SYBASE}

   --enable-track-vars 

   --without-mysql 

   --with-apache=../apache_1.3.29

   --disable-dba 

   --enable-session 

Reproduce code:
---------------
<?php

$db = sybase_connect("server", "user", "pass");

$res = sybase_query("select name from sysdatabases", $db);

while ($data = sybase_fetch_array($res)) {

        print "db: $data[0]\n";

        }

sybase_free_result($res);

sybase_close($db);

?>

Expected result:
----------------
a list of databases with no crashes

Actual result:
--------------
> php s.php

db: master

db: model

db: sybsystemprocs

db: tempdb

Segmentation fault (core dumped)



> dbx php core

dbx version 3.11.10

Type 'help' for help.

Core file created by program "php"



signal Segmentation fault at   [_efree:241 ,0x12013e7c8]       
CALCULATE_REAL_SIZE_AND_CACHE_INDEX(p->size);

(dbx) where

>  0 _efree(ptr = 0x52667250203a6264)
["/app/apps/web/php-4.3.5/Zend/zend_alloc.c":241, 0x12013e7c8]

   1 php_sybase_finish_results(result = 0x1400cd5b8)
["/app/apps/web/php-4.3.5/ext/sybase_ct/php_sybase_ct.c":1011,
0x1200e766c]

   2 zif_sybase_free_result(ht = 1, return_value = 0x1400d8298, this_ptr =
(nil), return_value_used = 0)
["/app/apps/web/php-4.3.5/ext/sybase_ct/php_sybase_ct.c":1602,
0x1200e8f20]

   3 execute(op_array = 0x1400c52d8)
["/app/apps/web/php-4.3.5/Zend/zend_execute.c":1621, 0x12016fdf4]

   4 zend_execute_scripts(type = 8, retval = (nil), file_count = 3)
["/app/apps/web/php-4.3.5/Zend/zend.c":889, 0x120155be0]

   5 php_execute_script(primary_file = 0x11fffec10)
["/app/apps/web/php-4.3.5/main/main.c":1731, 0x120116d84]

   6 main(argc = 2, argv = 0x11fffef28)
["/app/apps/web/php-4.3.5/sapi/cli/php_cli.c":822, 0x1201722e4]

(dbx) up

php_sybase_finish_results:1011  efree(result->tmp_buffer[i]);

(dbx) up

zif_sybase_free_result:1602  php_sybase_finish_results(result);

-- 
Edit bug report at http://bugs.php.net/?id=27828&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27828&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27828&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27828&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27828&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27828&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27828&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27828&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27828&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27828&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27828&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27828&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27828&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27828&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27828&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27828&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27828&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27828&r=float

Reply via email to