diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-04-26 19:40:05 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-12-28 18:28:10 +0100 |
| commit | bc92aabb75465a361c7f58384d6299efabed45ca (patch) | |
| tree | 72f658ba631fdf8c8e3ed93f4498d4c232c02f76 | |
| parent | f1e3c9e9c9aef42c63519d3a6d77e52f3ffa6b53 (diff) | |
| download | sparse-dev-bc92aabb75465a361c7f58384d6299efabed45ca.tar.gz | |
fix crash on bad expression in linearize_switch()
If the expression for the condition is dereferenced
for its type even if it is NULL.
Fix this by returning early if the expression linearize to VOID.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | linearize.c | 2 | ||||
| -rw-r--r-- | validation/empty-expr.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/linearize.c b/linearize.c index 2e146de7..deed3ca2 100644 --- a/linearize.c +++ b/linearize.c @@ -1945,6 +1945,8 @@ static pseudo_t linearize_switch(struct entrypoint *ep, struct statement *stmt) pseudo_t pseudo; pseudo = linearize_expression(ep, expr); + if (pseudo == VOID) + return pseudo; active = ep->active; if (!bb_reachable(active)) diff --git a/validation/empty-expr.c b/validation/empty-expr.c index 506cfba7..61decf73 100644 --- a/validation/empty-expr.c +++ b/validation/empty-expr.c @@ -18,7 +18,6 @@ static int bar(void) /* * check-name: empty expression - * check-known-to-fail * * check-error-start empty-expr.c:3:17: error: an expression is expected before ')' |
