comparison lwasm/lwasm.c @ 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 1f1a28b797e1
children d399df78e1ab
comparison
equal deleted inserted replaced
255:67acad9db5b3 256:bc25269d96bc
1075 1075
1076 rd.min = 0; 1076 rd.min = 0;
1077 rd.max = 0; 1077 rd.max = 0;
1078 rd.as = as; 1078 rd.as = as;
1079 1079
1080 if (!expr)
1081 return -1;
1082
1080 lw_expr_testterms(expr, lwasm_calculate_range_tf, (void *)&rd); 1083 lw_expr_testterms(expr, lwasm_calculate_range_tf, (void *)&rd);
1081 *min = rd.min; 1084 *min = rd.min;
1082 *max = rd.max; 1085 *max = rd.max;
1083 if (rd.min == -1) 1086 if (rd.min == -1)
1084 return -1; 1087 return -1;