From:             kermodebear at kermodebear dot org
Operating system: RedHat Linux
PHP version:      5.1.2
PHP Bug Type:     dBase related
Bug description:  Reading records causes malloc(): memory corruption:

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:
--------------
[EMAIL PROTECTED] cli]$ ./php test.php
*** glibc detected *** malloc(): memory corruption: 0x09efb7d0 ***
Aborted

With dbase_get_header_info() called before fetching records:

[EMAIL PROTECTED] cli]$ ./php test.php
*** glibc detected *** free(): invalid next size (fast): 0x091f60b8 ***
Aborted


-- 
Edit bug report at http://bugs.php.net/?id=36113&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36113&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36113&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36113&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36113&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36113&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36113&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36113&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36113&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36113&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36113&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36113&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36113&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36113&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36113&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36113&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36113&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36113&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36113&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36113&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36113&r=mysqlcfg

Reply via email to