From ce37a5bb2cfbc19ca2fae1aecfbdf015b5cfffb0 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Wed, 1 Nov 2006 00:11:49 +0000 Subject: [PATCH] - Fixed Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read valid db --- ext/dba/libcdb/cdb.c | 3 ++- ext/dba/tests/bug38698.phpt | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 ext/dba/tests/bug38698.phpt 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=== -- 2.40.0