|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read valid db.
Submitted: 2006-09-03 13:16 UTC Modified: 2006-11-03 19:06 UTC
From: oleg1917 at mail dot ru Assigned: helly
Status: Closed Package: DBM/DBA related
PHP Version: 5.2.0 OS: *
Private report: No CVE-ID:
 [2006-09-03 13:16 UTC] oleg1917 at mail dot ru
i used integer numbers packed into binary strings as keys.
for some numbers dba's cdbmake handler produces files that can't be read by Bernshtein's tools like cdbtest and CPAN's perl module CDB_File. And vice versa files produced by Bernshtein's cdbmake and CPAN's perl module CDB_File can't be read by dba's cdb handler.

Reproduce code:
        $handler = 'cdb_make';
        $db_file = '129php.cdb';
        echo "database handler: $handler\n";
        // print md5 checksum of 129test.cdb which is generated by cdb_make program
        if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
                dba_insert(pack('i',129), "Booo!", $db_make);
                // write md5 checksum of generated database file
        } else {
                echo "Error creating database\n";

Expected result:
database handler: cdb_make
string(32) "1f34b74bde3744265acfc21e0f30af95"
string(32) "1f34b74bde3744265acfc21e0f30af95"

Actual result:
database handler: cdb_make
string(32) "1f34b74bde3744265acfc21e0f30af95"
string(32) "b9ee8bfe966a01e287f8aa45b3fcc958"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-05 14:38 UTC]
Can you please provide a copy of the 129php.cdb file.
 [2006-09-05 15:07 UTC] oleg1917 at mail dot ru
here is it

i've got the same result on several boxes with centos 4.x, trustix 2.x distros and php 5.1.x
 [2006-09-12 15:25 UTC]
That's the PHP generated db, do you have the one made outside 
of PHP?
 [2006-09-12 16:40 UTC] oleg1917 at mail dot ru
this one
is created by Bernstein's cdbmake utility.
 [2006-11-01 00:13 UTC]
Fixed in head, will get fixed in 5.2.1
 [2006-11-03 19:06 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 15:01:32 2015 UTC