diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c index acafe952f3c..af6e1bb8f0a 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 00000000000..09f47e3007e --- /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===