Skip to content

Commit 93c774d

Browse files
committed
BR3392637: output/outieee: Fix nil dereference
The handling been broken in commit 9857807. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
1 parent e24e18e commit 93c774d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

output/outieee.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,23 @@ static int32_t ieee_segment(char *name, int *bits)
795795
define_label(name, seg->index + 1, 0L, false);
796796
ieee_seg_needs_update = NULL;
797797

798+
/*
799+
* In commit 98578071b9d71ecaa2344dd9c185237c1765041e
800+
* we reworked labels significantly which in turn lead
801+
* to the case where seg->name = NULL here and we get
802+
* nil dereference in next segments definitions.
803+
*
804+
* Lets placate this case with explicit name setting
805+
* if labels engine didn't set it yet.
806+
*
807+
* FIXME: Need to revisit this moment if such fix doesn't
808+
* break anything but since IEEE 695 format is veeery
809+
* old I don't expect there are many users left. In worst
810+
* case this should only lead to a memory leak.
811+
*/
812+
if (!seg->name)
813+
seg->name = nasm_strdup(name);
814+
798815
if (seg->use32)
799816
*bits = 32;
800817
else

0 commit comments

Comments
 (0)