aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linearize.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-04-26 19:40:05 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-12-28 18:28:10 +0100
commitbc92aabb75465a361c7f58384d6299efabed45ca (patch)
tree72f658ba631fdf8c8e3ed93f4498d4c232c02f76 /linearize.c
parentf1e3c9e9c9aef42c63519d3a6d77e52f3ffa6b53 (diff)
downloadsparse-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>
Diffstat (limited to 'linearize.c')
-rw-r--r--linearize.c2
1 files changed, 2 insertions, 0 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))