#36113 [Opn->Fbk]: Reading records causes malloc(): memory corruption:
| From: | tony2001@php.net | Date: | Sat, 21 Jan 2006 00:03:25 +0000 |
| Subject: | #36113 [Opn->Fbk]: Reading records causes malloc(): memory corruption: | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92324@lists.php.net to get a copy of this message | ||
ID: 36113
Updated by: tony2001@php.net
Reported By: kermodebear at kermodebear dot org
-Status: Open
+Status: Feedback
Bug Type: dBase related
Operating System: RedHat Linux
PHP Version: 5.1.2
New Comment:
Please try this patch:
http://tony2001.phpclub.net/dev/tmp/bug36113.diff
The field type you're using (TIMESTAMP) is not supported by the library
PHP uses to work with DBF files, so you should get a nice error message
in this case.
I don't use DBase, so please test this patch with supported fields,
just to make sure it doesn't break anything. Thanks.
Previous Comments:
------------------------------------------------------------------------
[2006-01-20 23:55:33] kermodebear at kermodebear dot org
Description:
------------
Reading records from a specific dBase file causes the following error
message:
*** glibc detected *** malloc(): memory corruption: 0x09efb7d0 ***
Aborted
However, if dbase_get_header_info() is called before the reading of
records, then a different error occurs:
*** glibc detected *** free(): invalid next size (fast): 0x08c4b270
***
Aborted
You can download the file causing the issue:
www.kermodebear.org/php_bug_data/sample.DBF
I thought that the file may be corrupted, so I downloaded three
different software packages ('DBF View', 'DBF Viewer 2000', 'DBF
Manager') and each of them was able to view the data without a problem.
I'm fairly certain that the file itself is not corrupt. Even if it is,
PHP should not cause these kinds of errors; The dbase_get_record
function should return false on error.
PHP version is 5.1.2;
./configure --enable-dbase
Reproduce code:
---------------
<?php
$h = dbase_open( 'sample.DBF', 0 );
// Uncomment the line below for a different error.
// dbase_get_header_info( $h );
for( $i = 1; $i <= dbase_numrecords( $h ); $i++ ) {
dbase_get_record( $h, $i );
}
?>
Expected result:
----------------
No output at all; The file should be opened, all records should be
read, and the script should end.
Actual result:
--------------
[jmiller@DEVEL cli]$ ./php test.php
*** glibc detected *** malloc(): memory corruption: 0x09efb7d0 ***
Aborted
With dbase_get_header_info() called before fetching records:
[jmiller@DEVEL cli]$ ./php test.php
*** glibc detected *** free(): invalid next size (fast): 0x091f60b8
***
Aborted
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36113&edit=1