[Date Prev][Date Next]
RE: Patch: bdb_db_hash() problems (ITS#1726)
Interesting. You actually have a machine with 9-bit bytes or 36-bit ints?
Much of your if condition should be resolved at compile time by the
preprocessor, not at runtime. It may be simpler just to do the single-byte
copies and eliminate the conditions altogether. For 4 bytes, it's probably
cheaper than invoking memcpy anyway.
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun
Symas: Premier OpenSource Development and Support
> -----Original Message-----
> From: owner-openldap-bugs@OpenLDAP.org
> [mailto:owner-openldap-bugs@OpenLDAP.org]On Behalf Of
> Sent: Thursday, April 04, 2002 1:09 AM
> To: openldap-its@OpenLDAP.org
> Subject: Patch: bdb_db_hash() problems (ITS#1726)
> Full_Name: Hallvard B. Furuseth
> Version: HEAD (2002-04-02)
> URL: http://folk.uio.no/hbf/OpenLDAP/bdb_db_hash.txt
> Submission from: (NULL) (126.96.36.199)
> bdb_db_hash() has 3 problems:
> - it accesses the bytes argument as an u_int32_t*, even though I can
> see no guarantee that bytes is aligned for integer access.
> - It expects a 4-byte value, but db->open() tests it with a string.
> - It can crash on hosts where integers have padding bits, since bad
> values for padding bits can cause a crash.
> Here is a patch. It removes the '#if LUTIL_HASH_BYTES' too, since if
> the #if fails it's still possible to use a simpler hash function than
> the one bdb provides.