php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19594 dba extension segfaults with the db2 driver
Submitted: 2002-09-25 09:28 UTC Modified: 2002-09-29 01:59 UTC
From: busterb at mail dot utexas dot edu Assigned:
Status: Closed Package: DBM/DBA related
PHP Version: 4CVS-2002-09-25 OS: Slackware Linux
Private report: No CVE-ID: None
 [2002-09-25 09:28 UTC] busterb at mail dot utexas dot edu
Creating a new db2 database causes a segfault with 
dba_open() 
 
$ php -v 
PHP 4.3.0-dev (cli), Copyright (c) 1997-2002 The PHP Group 
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend 
Technologies 
$ php -r "dba_open ("file_test", "n", "db2");" 
Segmentation fault 
 
This is the backtrace:   
#0  0x081ad050 in memp_register ()   
#1  0x40031c6b in db_open () from /lib/libdb.so.3   
#2  0x0807567a in dba_open_db2 ()   
#3  0x080752b0 in php_dba_open ()   
#4  0x08074d3e in zif_dba_open ()   
#5  0x0816928c in execute ()   
#6  0x0815cd0b in zend_execute_scripts ()   
#7  0x081374a9 in php_execute_script ()   
#8  0x0816dc6b in main ()   
#9  0x4028917d in __libc_start_main () from /lib/libc.so.6   

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-25 09:42 UTC] sander@php.net
Please recompile PHP with --enable-debug and post a new backtrace.
 [2002-09-25 10:15 UTC] busterb at mail dot utexas dot edu
Here it is. It looks like a string is not allocated 
correctly.  
  
#0  0x081ebb90 in memp_register ()  
#1  0x40040c6b in db_open () from /lib/libdb.so.3  
#2  0x0807aa0c in dba_open_db2 (info=0x82ea510) at  
/home/busterb/cvs/php4/php4/ext/dba/dba_db2.c:74  
#3  0x0807a4f8 in php_dba_open (ht=3,  
return_value=0x82ea4b4, this_ptr=0x0, return_value_used=0,  
    persistent=0) at  
/home/busterb/cvs/php4/php4/ext/dba/dba.c:346  
#4  0x08079e0e in zif_dba_open (ht=3356467,  
return_value=0x333733, this_ptr=0x333733,  
    return_value_used=3356467) at  
/home/busterb/cvs/php4/php4/ext/dba/dba.c:386  
#5  0x081a6dcf in execute (op_array=0x82e9fbc)  
    at  
/home/busterb/cvs/php4/php4/Zend/zend_execute.c:1602  
#6  0x0818f45c in zend_eval_string (str=0xbfffd55c "",  
retval_ptr=0x0,  
    string_name=0x333733 <Address 0x333733 out of bounds>)  
    at  
/home/busterb/cvs/php4/php4/Zend/zend_execute_API.c:630  
#7  0x081ac68d in main (argc=3, argv=0xbfffd764)  
    at /home/busterb/cvs/php4/php4/sapi/cli/php_cli.c:737  
#8  0x4033317d in __libc_start_main () from /lib/libc.so.6
 [2002-09-26 09:50 UTC] sniper@php.net
I can not reproduce this with latest CVS HEAD using your script. I think it's a problem in your db2 library.
What version is it?


 [2002-09-26 22:13 UTC] busterb at mail dot utexas dot edu
The version is 2.4.14, the default supplied with  
Slackware. 
 
I'm installing 2.7.7 now and will let Pat know if he needs 
to make an upgrade.
 [2002-09-28 21:24 UTC] busterb at mail dot utexas dot edu
I can't get a different copy of db2 installed, so I still don't know if dba works with something other than that installed with slack-current. The Sleepcat db2 installation process boggled my mind.

So, if anyone can confirm that it works at all, I'll leave it at that. This was just for testing the DBA class in PEAR, not that I would use db2 personally :P
 [2002-09-28 22:45 UTC] sniper@php.net
It works fine with db 2.7.7 (I have that installed).
btw. the PEAR DBA class should work with other
dbm libs too...like gdbm and ndbm..(there are quite a few..)

 [2002-09-29 01:59 UTC] busterb at mail dot utexas dot edu
I know that it should work, but I like to test the different drivers, just for QA on DBA (I maintain it). I'll add the db2 blessing to the DBA class before the next release. Plus, there always seem to be slight differences in how dba drivers work, for which the class compensates (e.g. no dba_replace in gdbm). Hmm, maybe that should be a separate bug report ;)

I suppose adding a dba_sync() before closing should be something that the DBA class does with a db2 database (having read the user notes on the PHP manual pages about it not writing to disk unless this is so). Thanks for the help.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Apr 15 22:01:23 2021 UTC