Skip to content

Commit 8c735c5

Browse files
committed
BR3392739: output/outbin: fix nil dereference for self following sections
In case if section follows itself we should yield an error, otherwise we hit nil dereference because there won't be any group of sections. After all "follow" attribute is rather to group sections other than self. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
1 parent 79ac0d6 commit 8c735c5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

output/outbin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ static void bin_cleanup(void)
335335
if (!s)
336336
nasm_fatal("section %s follows an invalid or"
337337
" unknown section (%s)", g->name, g->follows);
338+
if (s == g)
339+
nasm_fatal("section %s is self following", s->name);
338340
if (s->next && (s->next->flags & FOLLOWS_DEFINED) &&
339341
!strcmp(s->name, s->next->follows))
340342
nasm_fatal("sections %s and %s can't both follow"

0 commit comments

Comments
 (0)