From 207f80b981816a58100ee98be508a600f0a7a194 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 10 May 2013 09:30:06 +0300 Subject: [PATCH] deref: fix segfault parsing invalid c code Peter Huewe reports: "I know that the snippet is not valid c (',' instead of ';') but I think smatch should not segfault in this case." void test(void) { unsigned char temp1, unsigned short temp2; return; } Reported-by: Peter Huewe Signed-off-by: Dan Carpenter --- check_deref.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/check_deref.c b/check_deref.c index df9ba5bb..0cf3e920 100644 --- a/check_deref.c +++ b/check_deref.c @@ -114,6 +114,8 @@ static void match_declarations(struct symbol *sym) if ((get_base_type(sym))->type == SYM_ARRAY) return; + if (!sym->ident) + return; name = sym->ident->name; if (!sym->initializer) { set_state(my_id, name, sym, &uninitialized); -- 2.11.4.GIT