php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60947 Segmentation fault while executing ibase_db_info
Submitted: 2012-02-01 10:39 UTC Modified: 2012-04-02 07:30 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: a dot lukyanov at hostcomm dot ru Assigned: mariuz (profile)
Status: Closed Package: InterBase related
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: a dot lukyanov at hostcomm dot ru
New email:
PHP Version: OS:

 

 [2012-02-01 10:39 UTC] a dot lukyanov at hostcomm dot ru
Description:
------------
All versions of PHP takes segmentation fault while executing ibase_db_info() function. I solved this problem and wrote patch. Please apply it.

Thanks.

Test script:
---------------
<?php

$resource = ibase_service_attach("localhost", "testvh11_fb1234", "fb1234");
echo ibase_db_info($resource, "testvh11_fb1234.fdb", IBASE_STS_HDR_PAGES);

?>

Expected result:
----------------
testvh1 public_html # ./php-5.2.17/sapi/cli/php test.php 
 
Database "/var/lib/firebird/testvh11_fb1234.fdb" 
Database header page information: 
	Flags			0 
	Checksum		12345 
	Generation		65 
	Page size		8192 
	ODS version		11.2 
	Oldest transaction	20 
	Oldest active		21 
	Oldest snapshot		21 
	Next transaction	26 
	Bumped transaction	1 
	Sequence number		0 
	Next attachment ID	38 
	Implementation ID	24 
	Shadow count		0 
	Page buffers		0 
	Next header page	0 
	Database dialect	3 
	Creation date		Jan 30, 2012 15:10:47 
	Attributes		force write 
 
    Variable header data: 
	*END* 
testvh1 public_html #

Actual result:
--------------
testvh1 public_html # php test.php 
Segmentation fault
testvh1 public_html #

Patches

ibase_db_info.patch (last revision 2012-02-01 10:41 UTC by a dot lukyanov at hostcomm dot ru)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-02 05:29 UTC] mariuz@php.net
-Assigned To: +Assigned To: mariuz
 [2012-03-15 19:59 UTC] iliaa@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=324281
Log: Fixed bug #60947 (Segmentation fault while executing ibase_db_info)
 [2012-03-15 19:59 UTC] iliaa@php.net
-Status: Assigned +Status: Closed
 [2012-03-15 19:59 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-03-16 21:17 UTC] a dot lukyanov at hostcomm dot ru
I'm sorry, but current code in trunk not solved the problem.

Buffer increases on each iteration, because heap_p is bigger than heap_buf:

- snprintf(heap_p, heap_buf_size - (heap_buf - heap_p), "%s\n", result);
+ snprintf(heap_p, heap_buf_size - (heap_p - heap_buf), "%s\n", result);

This line should be corrected too:

- heap_p += line_len +2;
+ heap_p += line_len +1;

On each iteration I need overwrite last zero byte. In current code I recieve single line from Firebird server instead of multiline output (if not catch segfault).

Sorry for my bad English. Thanks.
 [2012-03-16 21:17 UTC] a dot lukyanov at hostcomm dot ru
-Status: Closed +Status: Assigned
 [2012-03-23 07:16 UTC] mariuz@php.net
-Status: Assigned +Status: Closed
 [2012-03-23 07:16 UTC] mariuz@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

iliaa fixed it in svn for all branches

Thanks
 [2012-03-23 07:19 UTC] mariuz@php.net
-Status: Closed +Status: Re-Opened
 [2012-04-02 07:30 UTC] mariuz@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-02 07:30 UTC] mariuz@php.net
-Status: Re-Opened +Status: Closed
 [2012-04-18 09:45 UTC] laruence@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=632825a4ff52710885201fe74998e436948f1e46
Log: Fixed bug #60947 (Segmentation fault while executing ibase_db_info)
 [2012-07-24 23:36 UTC] rasmus@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=632825a4ff52710885201fe74998e436948f1e46
Log: Fixed bug #60947 (Segmentation fault while executing ibase_db_info)
 [2013-11-17 09:33 UTC] laruence@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=632825a4ff52710885201fe74998e436948f1e46
Log: Fixed bug #60947 (Segmentation fault while executing ibase_db_info)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC