From: Domingo Alvarez Duarte Date: Thu, 31 Jan 2013 11:05:11 +0000 (+0100) Subject: Don't call elf_hash on NULL value X-Git-Tag: release_0_9_26~46 X-Git-Url: https://repo.or.cz/w/tinycc.git/commitdiff_plain/505329b5b3ee4cb47d0a3590ccd62a65dbf83fc9 Don't call elf_hash on NULL value Make sur elf_hash is never invoked with a NULL value. Signed-off-by: Thomas Preud'homme --- diff --git a/tccelf.c b/tccelf.c index a4dee195..5582bc53 100644 --- a/tccelf.c +++ b/tccelf.c @@ -114,7 +114,7 @@ ST_FUNC int put_elf_sym(Section *s, uplong value, unsigned long size, if (ELFW(ST_BIND)(info) != STB_LOCAL) { /* add another hashing entry */ nbuckets = base[0]; - h = elf_hash(name) % nbuckets; + h = name ? elf_hash(name) % nbuckets : 0; *ptr = base[2 + h]; base[2 + h] = sym_index; base[1]++;