Edit report at https://bugs.php.net/bug.php?id=60947&edit=1
ID: 60947 User updated by: a dot lukyanov at hostcomm dot ru Reported by: a dot lukyanov at hostcomm dot ru Summary: Segmentation fault while executing ibase_db_info -Status: Closed +Status: Assigned Type: Bug Package: InterBase related Operating System: All PHP Version: Irrelevant Assigned To: mariuz Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2012-03-15 19:59:22] il...@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-15 19:59:15] il...@php.net Automatic comment from SVN on behalf of iliaa Revision: http://svn.php.net/viewvc/?view=revision&revision=324281 Log: Fixed bug #60947 (Segmentation fault while executing ibase_db_info) ------------------------------------------------------------------------ [2012-02-01 10:39:15] 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 # ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60947&edit=1