cvs: php-src /ext/dba/libcdb cdb.c /ext/dba/tests bug38698.phpt
| From: | Marcus Boerger | Date: | Wed, 01 Nov 2006 00:11:49 +0000 |
| Subject: | cvs: php-src /ext/dba/libcdb cdb.c /ext/dba/tests bug38698.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-41273@lists.php.net to get a copy of this message | ||
helly Wed Nov 1 00:11:49 2006 UTC
Added files:
/php-src/ext/dba/tests bug38698.phpt
Modified files:
/php-src/ext/dba/libcdb cdb.c
Log:
- Fixed Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read valid db
http://cvs.php.net/viewvc.cgi/php-src/ext/dba/libcdb/cdb.c?r1=1.11&r2=1.12&diff_format=u
Index: php-src/ext/dba/libcdb/cdb.c
diff -u php-src/ext/dba/libcdb/cdb.c:1.11 php-src/ext/dba/libcdb/cdb.c:1.12
--- php-src/ext/dba/libcdb/cdb.c:1.11 Sun Jan 1 13:09:49 2006
+++ php-src/ext/dba/libcdb/cdb.c Wed Nov 1 00:11:49 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdb.c,v 1.11 2006/01/01 13:09:49 sniper Exp $ */
+/* $Id: cdb.c,v 1.12 2006/11/01 00:11:49 helly Exp $ */
/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
@@ -68,10 +68,11 @@
uint32 cdb_hash(char *buf, unsigned int len)
{
uint32 h;
+ const unsigned char * b = buf;
h = CDB_HASHSTART;
while (len--) {
- h = ( h + (h << 5)) ^ (*buf++);
+ h = ( h + (h << 5)) ^ (*b++);
}
return h;
}
@@ -188,6 +189,6 @@
/* {{{ cdb_version */
char *cdb_version()
{
- return "0.75, $Revision: 1.11 $";
+ return "0.75, $Revision: 1.12 $";
}
/* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/dba/tests/bug38698.phpt?view=markup&rev=1.1
Index: php-src/ext/dba/tests/bug38698.phpt
+++ php-src/ext/dba/tests/bug38698.phpt
--TEST--
Bug #38698 (Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read valid db)
--SKIPIF--
<?php
$handler = 'cdb_make';
require_once('skipif.inc');
?>
--FILE--
<?php
$db_file = '129php.cdb';
if (($db_make=dba_open($db_file, "n", 'cdb_make'))!==FALSE) {
dba_insert(pack('i',129), "Booo!", $db_make);
dba_close($db_make);
// write md5 checksum of generated database file
var_dump(md5_file($db_file));
@unlink($db_file);
} else {
echo "Error creating database\n";
}
?>
===DONE===
--EXPECTF--
string(32) "1f34b74bde3744265acfc21e0f30af95"
===DONE===