From e6e76e14dd6dc1c59ff2018bf5ce7b4b98300881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 11 Nov 2008 21:24:09 +0000 Subject: [PATCH] * elf_find_symbol() now checks if the hashtable section is greater than 0. * Whatever is the cause of #2733, this should at least not make it crash. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28615 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/elf.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/system/kernel/elf.cpp b/src/system/kernel/elf.cpp index 781e24fc3e..618868bb82 100644 --- a/src/system/kernel/elf.cpp +++ b/src/system/kernel/elf.cpp @@ -523,14 +523,11 @@ void dump_symbol(struct elf_image_info *image, struct Elf32_Sym *sym) static struct Elf32_Sym * elf_find_symbol(struct elf_image_info *image, const char *name) { - uint32 hash; - uint32 i; - - if (!image->dynamic_section) + if (image->dynamic_section == 0 || HASHTABSIZE(image) == 0) return NULL; - hash = elf_hash(name) % HASHTABSIZE(image); - for (i = HASHBUCKETS(image)[hash]; i != STN_UNDEF; + uint32 hash = elf_hash(name) % HASHTABSIZE(image); + for (uint32 i = HASHBUCKETS(image)[hash]; i != STN_UNDEF; i = HASHCHAINS(image)[i]) { if (!strcmp(SYMNAME(image, &image->syms[i]), name)) return &image->syms[i];