Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115994625
D39517.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D39517.diff
View Options
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -379,7 +379,7 @@
*/
uintptr_t rtld_round_page(uintptr_t);
uintptr_t rtld_trunc_page(uintptr_t);
-unsigned long elf_hash(const char *);
+Elf32_Word elf_hash(const char *);
const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *,
const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *);
void lockdflt_init(void);
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1796,23 +1796,20 @@
}
/*
- * Hash function for symbol table lookup. Don't even think about changing
- * this. It is specified by the System V ABI.
+ * SysV hash function for symbol table lookup. It is a slightly optimized
+ * version of the hash specified by the System V ABI.
*/
-unsigned long
+Elf32_Word
elf_hash(const char *name)
{
const unsigned char *p = (const unsigned char *)name;
- unsigned long h = 0;
- unsigned long g;
+ Elf32_Word h = 0;
while (*p != '\0') {
h = (h << 4) + *p++;
- if ((g = h & 0xf0000000) != 0)
- h ^= g >> 24;
- h &= ~g;
+ h ^= (h >> 24) & 0xf0;
}
- return (h);
+ return (h & 0x0fffffff);
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 2, 8:28 AM (20 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17902326
Default Alt Text
D39517.diff (1 KB)
Attached To
Mode
D39517: rtld: fix SysV hash function overflow
Attached
Detach File
Event Timeline
Log In to Comment