From 08d7137ef186da9f6e8582a845dcc6bf694109b4 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 23 Mar 2015 01:14:44 +0100 Subject: [PATCH] Fix #2212 - TinyCC struct parse crash --- shlr/tcc/tccgen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shlr/tcc/tccgen.c b/shlr/tcc/tccgen.c index 6fa5d6d374..cc1763f5c8 100644 --- a/shlr/tcc/tccgen.c +++ b/shlr/tcc/tccgen.c @@ -1829,6 +1829,9 @@ ST_FUNC void unary(void) if (tok != '(') tcc_error("'%s' undeclared", get_tok_str(t, NULL)); } + if (!s) { + tcc_error("invalid declaration '%s'", get_tok_str(t, NULL)); + } if ((s->type.t & (VT_STATIC | VT_INLINE | VT_BTYPE)) == (VT_STATIC | VT_INLINE | VT_FUNC)) { /* if referencing an inline function, then we generate a