From: Marcus Boerger Date: Wed, 1 Nov 2006 00:11:49 +0000 (+0000) Subject: - Fixed Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read... X-Git-Tag: RELEASE_1_0_0RC1~1160 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce37a5bb2cfbc19ca2fae1aecfbdf015b5cfffb0;p=php - Fixed Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read valid db --- diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c index acafe952f3..af6e1bb8f0 100644 --- a/ext/dba/libcdb/cdb.c +++ b/ext/dba/libcdb/cdb.c @@ -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; } diff --git a/ext/dba/tests/bug38698.phpt b/ext/dba/tests/bug38698.phpt new file mode 100755 index 0000000000..09f47e3007 --- /dev/null +++ b/ext/dba/tests/bug38698.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #38698 (Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read valid db) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +string(32) "1f34b74bde3744265acfc21e0f30af95" +===DONE===