mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-08 01:37:30 +00:00
- Fixed Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read valid db
This commit is contained in:
1 parent
d9c61f95c6
commit
ce37a5bb2c
2 files changed
+28
-1
No files matched your search
@@ -68,10 +68,11 @@ static int cdb_match(struct cdb *c, char *key, unsigned int len, uint32 pos TSRM
|
||||
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;
|
||||
}
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
--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===
|
||||
Reference in new issue
Block a user