aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/evaluate.c
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-07 04:22:15 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-09 23:29:10 +0100
commit82d8c05866c84a04cc5ecba74365573b4c29fcbc (patch)
treed409c2da9699f45df1fada4741becde581f16429 /evaluate.c
parent9b2efc158c5c9700ffe355c59356879df7c9cc12 (diff)
downloadsparse-82d8c05866c84a04cc5ecba74365573b4c29fcbc.tar.gz
fix premature examination of dereferenced object
in the fixes 696b243a5ae0 ("fix: evaluate_dereference() unexamined base type"), the pointer's examination was done prematurely, before the undereferenceable types are filtered out. This allows to examine the base abstract types when the expression was in fact not dereferenceable. Fix that by moving the examination to the top of the SYM_PTR's case since only pointers are concerned. Fixes: 696b243a5ae0 ("fix: evaluate_dereference() unexamined base type") Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'evaluate.c')
-rw-r--r--evaluate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/evaluate.c b/evaluate.c
index 19bdab92..ff6938a5 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1817,7 +1817,6 @@ static struct symbol *evaluate_dereference(struct expression *expr)
ctype = ctype->ctype.base_type;
target = ctype->ctype.base_type;
- examine_symbol_type(target);
switch (ctype->type) {
default:
@@ -1827,6 +1826,7 @@ static struct symbol *evaluate_dereference(struct expression *expr)
*expr = *op;
return expr->ctype;
case SYM_PTR:
+ examine_symbol_type(target);
node = alloc_symbol(expr->pos, SYM_NODE);
node->ctype.modifiers = target->ctype.modifiers & MOD_SPECIFIER;
merge_type(node, ctype);