Mercurial > hg > index.cgi
changeset 208:fa835b780ffb
Fix crash on conditionals with undefined symbols
Fix NULL pointer deref when parsing conditionals using undefined symbols.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sat, 09 Jun 2012 15:57:58 -0600 |
parents | 07e1fac76321 |
children | 52d9dd71f555 |
files | lwasm/pseudo.c |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lwasm/pseudo.c Sat Jun 09 15:47:22 2012 -0600 +++ b/lwasm/pseudo.c Sat Jun 09 15:57:58 2012 -0600 @@ -1014,7 +1014,8 @@ } e = lwasm_parse_cond(as, p); - lwasm_reduce_expr(as, e); + if (e) + lwasm_reduce_expr(as, e); if (e && lw_expr_intval(e) != 0) { as -> skipcond = 1; @@ -1036,7 +1037,8 @@ } e = lwasm_parse_cond(as, p); - lwasm_reduce_expr(as, e); + if (e) + lwasm_reduce_expr(as, e); if (e && lw_expr_intval(e) == 0) { as -> skipcond = 1; @@ -1059,7 +1061,8 @@ } e = lwasm_parse_cond(as, p); - lwasm_reduce_expr(as, e); + if (e) + lwasm_reduce_expr(as, e); if (e && lw_expr_intval(e) <= 0) { as -> skipcond = 1; @@ -1081,7 +1084,8 @@ } e = lwasm_parse_cond(as, p); - lwasm_reduce_expr(as, e); + if (e) + lwasm_reduce_expr(as, e); if (e && lw_expr_intval(e) < 0) { as -> skipcond = 1; @@ -1103,7 +1107,8 @@ } e = lwasm_parse_cond(as, p); - lwasm_reduce_expr(as, e); + if (e) + lwasm_reduce_expr(as, e); if (e && lw_expr_intval(e) >= 0) { as -> skipcond = 1; @@ -1125,7 +1130,8 @@ } e = lwasm_parse_cond(as, p); - lwasm_reduce_expr(as, e); + if (e) + lwasm_reduce_expr(as, e); if (e && lw_expr_intval(e) > 0) { as -> skipcond = 1;