comparison lwasm/output.c @ 500:733fd05ca2a8

Initialize temporary line structures properly Apparently, not initializing all elements of a struct can lead to random problems if something somewhere decides it should reference one of those uninitialized fields. Who knew. Set the temporary line_t structure to zeroes before passing it into anything when calculating the stuff for "object" output which should at least make things predictable. This seems to fix a crash reported by "strick" in Discord.
author William Astle <lost@l-w.ca>
date Thu, 29 Aug 2019 17:00:17 -0600
parents 999ae00d0919
children a812bb4d3a51
comparison
equal deleted inserted replaced
499:c3099c5d9d3e 500:733fd05ca2a8
893 // now the exports -- FIXME 893 // now the exports -- FIXME
894 for (ex = as -> exportlist; ex; ex = ex -> next) 894 for (ex = as -> exportlist; ex; ex = ex -> next)
895 { 895 {
896 int eval; 896 int eval;
897 lw_expr_t te; 897 lw_expr_t te;
898 line_t tl; 898 line_t tl = { 0 };
899 899
900 if (ex -> se == NULL) 900 if (ex -> se == NULL)
901 continue; 901 continue;
902 if (ex -> se -> section != s) 902 if (ex -> se -> section != s)
903 continue; 903 continue;
928 // FIXME - relocation table 928 // FIXME - relocation table
929 for (re = s -> reloctab; re; re = re -> next) 929 for (re = s -> reloctab; re; re = re -> next)
930 { 930 {
931 int offset; 931 int offset;
932 lw_expr_t te; 932 lw_expr_t te;
933 line_t tl; 933 line_t tl = { 0 };
934 934
935 tl.as = as; 935 tl.as = as;
936 as -> cl = &tl; 936 as -> cl = &tl;
937 as -> csect = s; 937 as -> csect = s;
938 as -> exportcheck = 1; 938 as -> exportcheck = 1;