[hackers] [scc] Check if the symbol is declared in unlinkhash() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 26 Sep 2015 18:45:50 +0200 (CEST)

commit 98c1fd02beabaf86babe42ac2c7d2efdc8b94755
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sat Sep 26 18:44:32 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Sep 26 18:44:32 2015 +0200

    Check if the symbol is declared in unlinkhash()
    
    Unlinkhash() can be used with no defined symbols,
    and in this case it will generate a segmentation
    fault.

diff --git a/cc1/symbol.c b/cc1/symbol.c
index 65a00a6..2de75b3 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -58,6 +58,8 @@ unlinkhash(Symbol *sym)
 {
         Symbol **h, *p, *prev;
 
+ if ((sym->flags & ISDECLARED) == 0)
+ return;
         h = &htab[hash(sym->name)];
         for (prev = p = *h; p != sym; prev = p, p = p->hash)
                 /* nothing */;
Received on Sat Sep 26 2015 - 18:45:50 CEST

This archive was generated by hypermail 2.3.0 : Sat Sep 26 2015 - 18:48:10 CEST