shithub: scc

Download patch

ref: 98c1fd02beabaf86babe42ac2c7d2efdc8b94755
parent: cc4a166a84e9241d3afd0d274041b265d230df6f
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Sep 26 14:44:32 EDT 2015

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.

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -58,6 +58,8 @@
 {
 	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 */;