changeset 256:bc25269d96bc

Fix crash on expression range calculation When attempting to calculate the range of a NULL expression, just indicate failure and bail out rather than dereferencing the expression and crashing out with no feedback.
author William Astle <lost@l-w.ca>
date Wed, 30 Jan 2013 21:47:15 -0700
parents 67acad9db5b3
children d5374e80dd04
files lwasm/lwasm.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/lwasm.c	Wed Jan 30 21:40:34 2013 -0700
+++ b/lwasm/lwasm.c	Wed Jan 30 21:47:15 2013 -0700
@@ -1077,6 +1077,9 @@
 	rd.max = 0;
 	rd.as = as;
 	
+	if (!expr)
+		return -1;
+	
 	lw_expr_testterms(expr, lwasm_calculate_range_tf, (void *)&rd);
 	*min = rd.min;
 	*max = rd.max;