aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher <sparse@chrisli.org>2010-03-28 22:41:49 -0700
committerChristopher <sparse@chrisli.org>2010-03-29 00:43:33 -0700
commit703499e552b45542a328e3016868419d65143f2b (patch)
tree929fe7f03c80acb756d9f7856a60c8e3ed1015d5
parentPointer don't inherent the alignment from base type (diff)
downloadsparse-703499e552b45542a328e3016868419d65143f2b.tar.gz
sparse-703499e552b45542a328e3016868419d65143f2b.tar.bz2
sparse-703499e552b45542a328e3016868419d65143f2b.zip
evaluate: check for NULL type inside typeof
This should fix the segfault report by Randy. It still doesn't parse the struct attribute correctly though. Signed-off-by: Christopher <sparse@chrisli.org>
-rw-r--r--evaluate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/evaluate.c b/evaluate.c
index 28bfd7c..cdbd064 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -340,7 +340,9 @@ static inline int classify_type(struct symbol *type, struct symbol **base)
type = type->ctype.base_type;
if (type->type == SYM_TYPEOF) {
type = evaluate_expression(type->initializer);
- if (type->type == SYM_NODE)
+ if (!type)
+ type = &bad_ctype;
+ else if (type->type == SYM_NODE)
type = type->ctype.base_type;
}
if (type->type == SYM_ENUM)