# HG changeset patch # User lost@l-w.ca # Date 1295738132 25200 # Node ID c80e5a0639674c1fd4bb7d9f47b21240085041e5 # Parent 6b9991fb39b6c90f33796516693e233491e91719 Brought forward patch to fix segfault with output outside of a section diff -r 6b9991fb39b6 -r c80e5a063967 lwasm/lwasm.c --- a/lwasm/lwasm.c Sat Jan 22 16:11:15 2011 -0700 +++ b/lwasm/lwasm.c Sat Jan 22 16:15:32 2011 -0700 @@ -227,6 +227,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; + } if (size == 4) {