Mercurial > hg-old > index.cgi
diff lwasm/lwasm.c @ 447:00924eeb2ec8 3.0
Fixed segfault with output outside of a section
author | lost@l-w.ca |
---|---|
date | Thu, 04 Nov 2010 23:25:18 -0600 |
parents | 4b137a8cf32a |
children |
line wrap: on
line diff
--- a/lwasm/lwasm.c Thu Nov 04 22:40:57 2010 -0600 +++ b/lwasm/lwasm.c Thu Nov 04 23:25:18 2010 -0600 @@ -228,6 +228,11 @@ void lwasm_emit(line_t *cl, int byte) { + if (cl -> as -> output_format == OUTPUT_OBJ && cl -> csect == NULL) + { + lwasm_register_error(cl -> as, cl, "Instruction generating output outside of a section"); + return; + } if (cl -> outputl < 0) cl -> outputl = 0; @@ -662,6 +667,12 @@ { reloctab_t *re; lw_expr_t te; + + if (l->csect == NULL) + { + lwasm_register_error(l -> as, l, "Instruction generating output outside of a section"); + return -1; + } if (size == 4) {